Skip to content

Commit acddba6

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: fix merge [Intl] Update ICU data from 74.1 to 75.1 use DeprecatedCallableInfo for Twig callables if possible [Filesystem] Add a warning about `chown()` and `chgrp()` on Windows [String] Update wcswidth data with Unicode 16 PhpSubprocess: Add flag PREG_OFFSET_CAPTURE to preg_match to identify the offset Work around parse_url() bug [Ldap] Clean `ldap_connect()` call in `LdapTestCase` [HttpFoundation] Update links for X-Accel-Redirect and fail properly when X-Accel-Mapping is missing
2 parents 733ddb2 + 2898645 commit acddba6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

HttpClientTrait.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,10 @@ private static function resolveUrl(array $url, ?array $base, array $queryDefault
626626
private static function parseUrl(string $url, array $query = [], array $allowedSchemes = ['http' => 80, 'https' => 443]): array
627627
{
628628
if (false === $parts = parse_url($url)) {
629-
throw new InvalidArgumentException(\sprintf('Malformed URL "%s".', $url));
629+
if ('/' !== ($url[0] ?? '') || false === $parts = parse_url($url.'#')) {
630+
throw new InvalidArgumentException(\sprintf('Malformed URL "%s".', $url));
631+
}
632+
unset($parts['fragment']);
630633
}
631634

632635
if ($query) {

NativeHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ private static function createRedirectResolver(array $options, string $host, str
414414

415415
[$host, $port] = self::parseHostPort($url, $info);
416416

417-
if (false !== (parse_url($location, \PHP_URL_HOST) ?? false)) {
417+
if (false !== (parse_url($location.'#', \PHP_URL_HOST) ?? false)) {
418418
// Authorization and Cookie headers MUST NOT follow except for the initial host name
419419
$requestHeaders = $redirectHeaders['host'] === $host && $redirectHeaders['port'] === $port ? $redirectHeaders['with_auth'] : $redirectHeaders['no_auth'];
420420
$requestHeaders[] = 'Host: '.$host.$port;

0 commit comments

Comments
 (0)