Skip to content

Commit 7df6f57

Browse files
Merge branch '7.1' into 7.2
* 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
2 parents b77b5a8 + 2251578 commit 7df6f57

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Request.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ public static function create(string $uri, string $method = 'GET', array $parame
300300
$server['PATH_INFO'] = '';
301301
$server['REQUEST_METHOD'] = strtoupper($method);
302302

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

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

Tests/RequestTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ public function testCreateWithRequestUri()
311311
* ["foo\u0000"]
312312
* [" foo"]
313313
* ["foo "]
314-
* [":"]
314+
* ["//"]
315+
* ["foo:bar"]
315316
*/
316317
public function testCreateWithBadRequestUri(string $uri)
317318
{

0 commit comments

Comments
 (0)