Skip to content

Commit 2251578

Browse files
Merge branch '6.4' into 7.1
* 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
2 parents f4419ec + 49be6b8 commit 2251578

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Request.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ public static function create(string $uri, string $method = 'GET', array $parame
301301
$server['PATH_INFO'] = '';
302302
$server['REQUEST_METHOD'] = strtoupper($method);
303303

304-
$components = parse_url($uri);
305-
if (false === $components) {
304+
if (false === $components = parse_url(\strlen($uri) !== strcspn($uri, '?#') ? $uri : $uri.'#')) {
306305
throw new BadRequestException('Invalid URI.');
307306
}
308307

@@ -325,9 +324,11 @@ public static function create(string $uri, string $method = 'GET', array $parame
325324
if ('https' === $components['scheme']) {
326325
$server['HTTPS'] = 'on';
327326
$server['SERVER_PORT'] = 443;
328-
} else {
327+
} elseif ('http' === $components['scheme']) {
329328
unset($server['HTTPS']);
330329
$server['SERVER_PORT'] = 80;
330+
} else {
331+
throw new BadRequestException('Invalid URI: http(s) scheme expected.');
331332
}
332333
}
333334

Tests/RequestTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ public function testCreateWithRequestUri()
310310
* ["foo\u0000"]
311311
* [" foo"]
312312
* ["foo "]
313-
* [":"]
313+
* ["//"]
314+
* ["foo:bar"]
314315
*/
315316
public function testCreateWithBadRequestUri(string $uri)
316317
{

0 commit comments

Comments
 (0)