Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 5.4:
  [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
  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
  • Loading branch information
xabbuh committed Sep 15, 2024
2 parents 4c92046 + f09ba83 commit 23dcaa3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion HttpClientTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,10 @@ private static function resolveUrl(array $url, ?array $base, array $queryDefault
private static function parseUrl(string $url, array $query = [], array $allowedSchemes = ['http' => 80, 'https' => 443]): array
{
if (false === $parts = parse_url($url)) {
throw new InvalidArgumentException(sprintf('Malformed URL "%s".', $url));
if ('/' !== ($url[0] ?? '') || false === $parts = parse_url($url.'#')) {
throw new InvalidArgumentException(sprintf('Malformed URL "%s".', $url));
}
unset($parts['fragment']);
}

if ($query) {
Expand Down
2 changes: 1 addition & 1 deletion NativeHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ private static function createRedirectResolver(array $options, string $host, str

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

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

0 comments on commit 23dcaa3

Please sign in to comment.