fix double-decoding in the routing system

This commit is contained in:
Tobias Schultze 2012-12-14 23:08:21 +01:00
parent 85be887e59
commit 8b2c17f803
2 changed files with 6 additions and 3 deletions

View File

@ -70,7 +70,10 @@ class RouterListener
// 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)));

View File

@ -107,7 +107,7 @@ class HttpUtils
{
if ('/' !== $path[0]) {
try {
$parameters = $this->router->match($request->getPathInfo());
$parameters = $this->router->match(urlencode($request->getPathInfo()));
return $path === $parameters['_route'];
} catch (MethodNotAllowedException $e) {
@ -129,7 +129,7 @@ class HttpUtils
}
try {
$parameters = $this->router->match($request->getPathInfo());
$parameters = $this->router->match(urlencode($request->getPathInfo()));
if (isset($parameters['_locale'])) {
$context->setParameter('_locale', $parameters['_locale']);