bug #39358 [HttpFoundation] fix parsing some special chars with HeaderUtils::parseQuery() (nicolas-grekas)
This PR was merged into the 5.2 branch.
Discussion
----------
[HttpFoundation] fix parsing some special chars with HeaderUtils::parseQuery()
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #39307
| License | MIT
| Doc PR | -
Same as #39357 for 5.2
Commits
-------
8682bdc521
[HttpFoundation] fix parsing some special chars with HeaderUtils::parseQuery()
This commit is contained in:
commit
fd34c9c22f
@ -228,7 +228,7 @@ class HeaderUtils
|
||||
if (false === $i = strpos($k, '[')) {
|
||||
$q[] = bin2hex($k).$v;
|
||||
} else {
|
||||
$q[] = substr_replace($k, bin2hex(substr($k, 0, $i)), 0, $i).$v;
|
||||
$q[] = bin2hex(substr($k, 0, $i)).rawurlencode(substr($k, $i)).$v;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,6 +151,7 @@ class HeaderUtilsTest extends TestCase
|
||||
['a[b]=c', 'a%5Bb%5D=c'],
|
||||
['a[b][c.d]=c', 'a%5Bb%5D%5Bc.d%5D=c'],
|
||||
['a%5Bb%5D=c'],
|
||||
['f[%2525][%26][%3D][p.c]=d', 'f%5B%2525%5D%5B%26%5D%5B%3D%5D%5Bp.c%5D=d'],
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user