fix double-decoding in the routing system
This commit is contained in:
parent
85be887e59
commit
8b2c17f803
@ -70,7 +70,10 @@ class RouterListener
|
|||||||
|
|
||||||
// add attributes based on the path info (routing)
|
// add attributes based on the path info (routing)
|
||||||
try {
|
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) {
|
if (null !== $this->logger) {
|
||||||
$this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters)));
|
$this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters)));
|
||||||
|
@ -107,7 +107,7 @@ class HttpUtils
|
|||||||
{
|
{
|
||||||
if ('/' !== $path[0]) {
|
if ('/' !== $path[0]) {
|
||||||
try {
|
try {
|
||||||
$parameters = $this->router->match($request->getPathInfo());
|
$parameters = $this->router->match(urlencode($request->getPathInfo()));
|
||||||
|
|
||||||
return $path === $parameters['_route'];
|
return $path === $parameters['_route'];
|
||||||
} catch (MethodNotAllowedException $e) {
|
} catch (MethodNotAllowedException $e) {
|
||||||
@ -129,7 +129,7 @@ class HttpUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$parameters = $this->router->match($request->getPathInfo());
|
$parameters = $this->router->match(urlencode($request->getPathInfo()));
|
||||||
|
|
||||||
if (isset($parameters['_locale'])) {
|
if (isset($parameters['_locale'])) {
|
||||||
$context->setParameter('_locale', $parameters['_locale']);
|
$context->setParameter('_locale', $parameters['_locale']);
|
||||||
|
Reference in New Issue
Block a user