Skip to content

Commit

Permalink
merged branch Tobion/fix-double-encoding (PR #6363)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.0 branch.

Commits
-------

8b2c17f fix double-decoding in the routing system

Discussion
----------

fix double-decoding in the routing system

@fabpot @vicb This should fix it. You know what ;) Don't want to leak more information.
And the good thing, it's no hack nor does it break BC.
  • Loading branch information
fabpot committed Dec 20, 2012
2 parents 2f0b2a1 + 8b2c17f commit d90e55c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -70,7 +70,10 @@ public function onKernelRequest(GetResponseEvent $event)

// add attributes based on the path info (routing)
try {
$parameters = $this->router->match($request->getPathInfo());
// The path is returned in decoded form from the request, so we need to
// encode it again as the router applies its own decoding. This prevents
// double-decoding.
$parameters = $this->router->match(urlencode($request->getPathInfo()));

if (null !== $this->logger) {
$this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters)));
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Security/Http/HttpUtils.php
Expand Up @@ -107,7 +107,7 @@ public function checkRequestPath(Request $request, $path)
{
if ('/' !== $path[0]) {
try {
$parameters = $this->router->match($request->getPathInfo());
$parameters = $this->router->match(urlencode($request->getPathInfo()));

return $path === $parameters['_route'];
} catch (MethodNotAllowedException $e) {
Expand All @@ -129,7 +129,7 @@ private function resetLocale(Request $request)
}

try {
$parameters = $this->router->match($request->getPathInfo());
$parameters = $this->router->match(urlencode($request->getPathInfo()));

if (isset($parameters['_locale'])) {
$context->setParameter('_locale', $parameters['_locale']);
Expand Down

0 comments on commit d90e55c

Please sign in to comment.