File tree 2 files changed +18
-0
lines changed
src/Symfony/Bundle/FrameworkBundle
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)
146
146
return '%% ' ;
147
147
}
148
148
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
+
149
153
$ resolved = $ container ->getParameter ($ match [1 ]);
150
154
151
155
if (is_string ($ resolved ) || is_numeric ($ resolved )) {
Original file line number Diff line number Diff line change @@ -131,6 +131,20 @@ public function testPatternPlaceholders()
131
131
);
132
132
}
133
133
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
+
134
148
public function testHostPlaceholders ()
135
149
{
136
150
$ routes = new RouteCollection ();
You can’t perform that action at this time.
0 commit comments