Skip to content

Commit

Permalink
bug #39358 [HttpFoundation] fix parsing some special chars with Heade…
Browse files Browse the repository at this point in the history
…rUtils::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
-------

8682bdc [HttpFoundation] fix parsing some special chars with HeaderUtils::parseQuery()
  • Loading branch information
fabpot committed Dec 8, 2020
2 parents f4e1556 + 8682bdc commit fd34c9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/HeaderUtils.php
Expand Up @@ -228,7 +228,7 @@ public static function parseQuery(string $query, bool $ignoreBrackets = false, s
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;
}
}

Expand Down
Expand Up @@ -151,6 +151,7 @@ public function provideParseQuery()
['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'],
];
}

Expand Down

0 comments on commit fd34c9c

Please sign in to comment.