Ver código fonte

merged branch Seldaek/urlgen (PR #1573)

Commits
-------

ac1448f [Routing] Revert to rawurlencode + whitelisting of '/'

Discussion
----------

[Routing] Revert to rawurlencode + whitelisting of '/'

After more discussion on 761724ae57d07cee2368bee86a2f1fe22cf188fc - sorry you merged too fast for once ;)
Fabien Potencier 14 anos atrás
pai
commit
c061b4576b

+ 3 - 6
src/Symfony/Component/Routing/Generator/UrlGenerator.php

@@ -28,11 +28,8 @@ use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
 class UrlGenerator implements UrlGeneratorInterface
 {
     protected $context;
-    protected $escapedChars = array(
-        '%' => '%25',
-        '+' => '%2B',
-        '#' => '%23',
-        '?' => '%3F',
+    protected $decodedChars = array(
+        '%2F' => '/',
     );
 
     private $routes;
@@ -131,7 +128,7 @@ class UrlGenerator implements UrlGeneratorInterface
                     }
 
                     if (!$isEmpty || !$optional) {
-                        $url = $token[1].strtr($tparams[$token[3]], $this->escapedChars).$url;
+                        $url = $token[1].strtr(rawurlencode($tparams[$token[3]]), $this->decodedChars).$url;
                     }
 
                     $optional = false;