Bläddra i källkod

[Routing] UrlMatcher shouldn't collapse multiple slashes

* fixes a problem with security (/foo/bar and /foo///bar are not the same URL as far as security is concerned)
* this can still be done in your web server configuration or by adding a core.request listener
Jordi Boggiano 14 år sedan
förälder
incheckning
4c0ea6179b

+ 1 - 2
src/Symfony/Component/Routing/Matcher/UrlMatcher.php

@@ -106,7 +106,6 @@ class UrlMatcher implements UrlMatcherInterface
             $url = substr($url, 0, $pos);
         }
 
-        // remove multiple /
-        return preg_replace('#/+#', '/', $url);
+        return $url;
     }
 }

+ 0 - 1
tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php

@@ -25,7 +25,6 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase
         $matcher = new UrlMatcherForTests($collection, array(), array());
 
         $this->assertEquals('/foo', $matcher->normalizeUrl('/foo?foo=bar'), '->normalizeUrl() removes the query string');
-        $this->assertEquals('/foo/bar', $matcher->normalizeUrl('/foo//bar'), '->normalizeUrl() removes duplicated /');
     }
 
     public function testMatch()