Skip to content

Commit

Permalink
Merge branch '7.1' into 7.2
Browse files Browse the repository at this point in the history
* 7.1:
  fix merge
  fix merge
  Bump Symfony version to 7.1.9
  Work around parse_url() bug (bis)
  Update VERSION for 7.1.8
  Update CHANGELOG for 7.1.8
  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 b77b5a8 + 2251578 commit 7df6f57
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 @@ -300,8 +300,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 @@ -324,9 +323,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 @@ -311,7 +311,8 @@ public function testCreateWithRequestUri()
* ["foo\u0000"]
* [" foo"]
* ["foo "]
* [":"]
* ["//"]
* ["foo:bar"]
*/
public function testCreateWithBadRequestUri(string $uri)
{
Expand Down

0 comments on commit 7df6f57

Please sign in to comment.