Navigation Menu

Skip to content

Commit

Permalink
fix double-decoding in the routing system
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Dec 14, 2012
1 parent 85be887 commit 8b2c17f
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 8b2c17f

Please sign in to comment.