File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,10 @@ private function resolve($value)
146146 return '%% ' ;
147147 }
148148
149+ if (preg_match ('/^env\(\w+\)$/ ' , $ match [1 ])) {
150+ throw new RuntimeException (sprintf ('Using "%%%s%%" is not allowed in routing configuration. ' , $ match [1 ]));
151+ }
152+
149153 $ resolved = $ container ->getParameter ($ match [1 ]);
150154
151155 if (is_string ($ resolved ) || is_numeric ($ resolved )) {
Original file line number Diff line number Diff line change @@ -131,6 +131,20 @@ public function testPatternPlaceholders()
131131 );
132132 }
133133
134+ /**
135+ * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
136+ * @expectedExceptionMessage Using "%env(FOO)%" is not allowed in routing configuration.
137+ */
138+ public function testEnvPlaceholders ()
139+ {
140+ $ routes = new RouteCollection ();
141+
142+ $ routes ->add ('foo ' , new Route ('/%env(FOO)% ' ));
143+
144+ $ router = new Router ($ this ->getServiceContainer ($ routes ), 'foo ' );
145+ $ router ->getRouteCollection ();
146+ }
147+
134148 public function testHostPlaceholders ()
135149 {
136150 $ routes = new RouteCollection ();
You can’t perform that action at this time.
0 commit comments