Skip to content

Commit 2b99b0a

Browse files
committed
Url::canonicalize() char " does not need to be encoded
1 parent 0a8a706 commit 2b99b0a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Http/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public function isEqual(string|self|UrlImmutable $url): bool
332332
public function canonicalize(): static
333333
{
334334
$this->path = preg_replace_callback(
335-
'#[^!$&\'()*+,/:;=@%]+#',
335+
'#[^!$&\'()*+,/:;=@%"]+#',
336336
fn(array $m): string => rawurlencode($m[0]),
337337
self::unescape($this->path, '%/'),
338338
);

tests/Http/Url.canonicalize.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $url = new Url('http://host/%1f%20 %21!%22"%23%24$%25%26&%27\'%28(%29)%2a*%2b+%2
2626
. '%41A%42B%43C%44D%45E%46F%47G%48H%49I%4aJ%4bK%4cL%4dM%4eN%4fO%50P%51Q%52R%53S%54T%55U%56V%57W%58X%59Y%5aZ%5b[%5c\%5d]%5e^%5f_%60`'
2727
. '%61a%62b%63c%64d%65e%66f%67g%68h%69i%6aj%6bk%6cl%6dm%6en%6fo%70p%71q%72r%73s%74t%75u%76v%77w%78x%79y%7az%7b{%7c|%7d}%7e~%7fá');
2828
$url->canonicalize();
29-
Assert::same('http://host/%1F%20%20!!%22%22%23$$%25&&\'\'(())**++,,--..%2F/00112233445566778899::;;%3C%3C==%3E%3E%3F@@'
29+
Assert::same('http://host/%1F%20%20!!""%23$$%25&&\'\'(())**++,,--..%2F/00112233445566778899::;;%3C%3C==%3E%3E%3F@@'
3030
. 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ%5B%5B%5C%5C%5D%5D%5E%5E__%60%60'
3131
. 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz%7B%7B%7C%7C%7D%7D~~%7F%C3%A1', (string) $url);
3232

0 commit comments

Comments
 (0)