Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8682bdc

Browse files
[HttpFoundation] fix parsing some special chars with HeaderUtils::parseQuery()
1 parent ac9858b commit 8682bdc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/HttpFoundation/HeaderUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public static function parseQuery(string $query, bool $ignoreBrackets = false, s
228228
if (false === $i = strpos($k, '[')) {
229229
$q[] = bin2hex($k).$v;
230230
} else {
231-
$q[] = substr_replace($k, bin2hex(substr($k, 0, $i)), 0, $i).$v;
231+
$q[] = bin2hex(substr($k, 0, $i)).rawurlencode(substr($k, $i)).$v;
232232
}
233233
}
234234

src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public function provideParseQuery()
151151
['a[b]=c', 'a%5Bb%5D=c'],
152152
['a[b][c.d]=c', 'a%5Bb%5D%5Bc.d%5D=c'],
153153
['a%5Bb%5D=c'],
154+
['f[%2525][%26][%3D][p.c]=d', 'f%5B%2525%5D%5B%26%5D%5B%3D%5D%5Bp.c%5D=d'],
154155
];
155156
}
156157

0 commit comments

Comments
 (0)