Skip to content

Commit

Permalink
Merge branch '6.4' into 7.1
Browse files Browse the repository at this point in the history
* 6.4:
  Work around parse_url() bug (bis)
  Bump Symfony version to 6.4.16
  fix PHP 7.2 compatibility
  silence PHP warnings issued by Redis::connect()
  Update VERSION for 6.4.15
  Update CHANGELOG for 6.4.15
  Bump Symfony version to 5.4.48
  Update VERSION for 5.4.47
  Update CHANGELOG for 5.4.47
  [Routing] Fix: lost priority when defining hosts in configuration
  fix dumping tests to skip with data providers
  • Loading branch information
nicolas-grekas committed Nov 13, 2024
2 parents f4419ec + 49be6b8 commit 2251578
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ public static function create(string $uri, string $method = 'GET', array $parame
$server['PATH_INFO'] = '';
$server['REQUEST_METHOD'] = strtoupper($method);

$components = parse_url($uri);
if (false === $components) {
if (false === $components = parse_url(\strlen($uri) !== strcspn($uri, '?#') ? $uri : $uri.'#')) {
throw new BadRequestException('Invalid URI.');
}

Expand All @@ -325,9 +324,11 @@ public static function create(string $uri, string $method = 'GET', array $parame
if ('https' === $components['scheme']) {
$server['HTTPS'] = 'on';
$server['SERVER_PORT'] = 443;
} else {
} elseif ('http' === $components['scheme']) {
unset($server['HTTPS']);
$server['SERVER_PORT'] = 80;
} else {
throw new BadRequestException('Invalid URI: http(s) scheme expected.');
}
}

Expand Down
3 changes: 2 additions & 1 deletion Tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ public function testCreateWithRequestUri()
* ["foo\u0000"]
* [" foo"]
* ["foo "]
* [":"]
* ["//"]
* ["foo:bar"]
*/
public function testCreateWithBadRequestUri(string $uri)
{
Expand Down

0 comments on commit 2251578

Please sign in to comment.