Przeglądaj źródła

[Routing] Fix ApacheDumper when a space appears in a default value

Jordi Boggiano 14 lat temu
rodzic
commit
2b5e22d961

+ 1 - 0
src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php

@@ -62,6 +62,7 @@ class ApacheMatcherDumper extends MatcherDumper
                     ':'  => '\\:',
                     '='  => '\\=',
                     '\\' => '\\\\',
+                    ' '  => '\\ ',
                 ));
             }
             $variables = implode(',', $variables);

+ 4 - 0
tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.apache

@@ -49,6 +49,10 @@ RewriteRule .* $0/ [QSA,L,R=301]
 RewriteCond %{REQUEST_URI} ^/test/([^/]+?)/$
 RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz5,E=_ROUTING_foo:%1]
 
+# baz6
+RewriteCond %{REQUEST_URI} ^/test/baz$
+RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz6,E=_ROUTING_foo:bar\ baz]
+
 # 405 Method Not Allowed
 RewriteCond %{_ROUTING__allow_GET} !-z [OR]
 RewriteCond %{_ROUTING__allow_HEAD} !-z [OR]

+ 5 - 0
tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php

@@ -68,6 +68,11 @@ class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase
             array(),
             array('_method' => 'post')
         ));
+        // complex
+        $collection->add('baz6', new Route(
+            '/test/baz',
+            array('foo' => 'bar baz')
+        ));
 
         $dumper = new ApacheMatcherDumper($collection);