Skip to content

Commit 5ccfc93

Browse files
committed
Imrpove Host normalization
1 parent 43fe2b8 commit 5ccfc93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

interfaces/UriString.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,10 @@ public static function parseNormalized(Stringable|string $uri): array
309309
if ($host === $components['host']) {
310310
$host = (string) preg_replace_callback(
311311
'/%[0-9A-F]{2}/i',
312-
fn (array $matches): string => strtoupper($matches[0]),
312+
fn (array $matches) => 1 === preg_match('/%([0-7][0-9a-f])/', $matches[0]) ? rawurldecode($matches[0]) : strtoupper($matches[0]),
313313
strtolower($host)
314314
);
315+
315316
if ($isSupported) {
316317
$idnaHost = IdnaConverter::toAscii(rawurldecode($components['host']));
317318
if (!$idnaHost->hasErrors()) {

0 commit comments

Comments
 (0)