Jelajahi Sumber

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

Jordi Boggiano 14 tahun lalu
induk
melakukan
ac1448f573
1 mengubah file dengan 3 tambahan dan 6 penghapusan
  1. 3 6
      src/Symfony/Component/Routing/Generator/UrlGenerator.php

+ 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;