File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
src/Symfony/Component/Routing Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,7 @@ private function parseConfigs(\DOMElement $node, $path)
208208 $ options = [];
209209 $ condition = null ;
210210
211+ /** @var \DOMElement $n */
211212 foreach ($ node ->getElementsByTagNameNS (self ::NAMESPACE_URI , '* ' ) as $ n ) {
212213 if ($ node !== $ n ->parentNode ) {
213214 continue ;
@@ -226,7 +227,7 @@ private function parseConfigs(\DOMElement $node, $path)
226227 $ requirements [$ n ->getAttribute ('key ' )] = trim ($ n ->textContent );
227228 break ;
228229 case 'option ' :
229- $ options [$ n ->getAttribute ('key ' )] = trim ($ n ->textContent );
230+ $ options [$ n ->getAttribute ('key ' )] = XmlUtils:: phpize ( trim ($ n ->textContent ) );
230231 break ;
231232 case 'condition ' :
232233 $ condition = trim ($ n ->textContent );
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <routes xmlns =" http://symfony.com/schema/routing"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://symfony.com/schema/routing
5+ http://symfony.com/schema/routing/routing-1.0.xsd" >
6+
7+ <route id =" app_utf8" path =" /utf8" >
8+ <option key =" utf8" >true</option >
9+ </route >
10+ <route id =" app_no_utf8" path =" /no-utf8" >
11+ <option key =" utf8" >false</option >
12+ </route >
13+ </routes >
Original file line number Diff line number Diff line change @@ -83,6 +83,26 @@ public function testLoadWithImport()
8383 }
8484 }
8585
86+ public function testUtf8Route ()
87+ {
88+ $ loader = new XmlFileLoader (new FileLocator ([__DIR__ .'/../Fixtures/localized ' ]));
89+ $ routeCollection = $ loader ->load ('utf8.xml ' );
90+ $ routes = $ routeCollection ->all ();
91+
92+ $ this ->assertCount (2 , $ routes , 'Two routes are loaded ' );
93+ $ this ->assertContainsOnly ('Symfony\Component\Routing\Route ' , $ routes );
94+
95+ $ utf8Route = $ routeCollection ->get ('app_utf8 ' );
96+
97+ $ this ->assertSame ('/utf8 ' , $ utf8Route ->getPath ());
98+ $ this ->assertTrue ($ utf8Route ->getOption ('utf8 ' ), 'Must be utf8 ' );
99+
100+ $ noUtf8Route = $ routeCollection ->get ('app_no_utf8 ' );
101+
102+ $ this ->assertSame ('/no-utf8 ' , $ noUtf8Route ->getPath ());
103+ $ this ->assertFalse ($ noUtf8Route ->getOption ('utf8 ' ), 'Must not be utf8 ' );
104+ }
105+
86106 /**
87107 * @expectedException \InvalidArgumentException
88108 * @dataProvider getPathsToInvalidFiles
You can’t perform that action at this time.
0 commit comments