File tree 2 files changed +17
-0
lines changed
src/Symfony/Component/Routing
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ public static function compile(Route $route)
59
59
$ staticPrefix = $ result ['staticPrefix ' ];
60
60
61
61
$ pathVariables = $ result ['variables ' ];
62
+
63
+ foreach ($ pathVariables as $ pathParam ) {
64
+ if ('_fragment ' == $ pathParam ) {
65
+ throw new \LogicException (sprintf ('Route pattern "%s" cannot contain "_fragment" as a path parameter. ' , $ route ->getPath ()));
66
+ }
67
+ }
68
+
62
69
$ variables = array_merge ($ variables , $ pathVariables );
63
70
64
71
$ tokens = $ result ['tokens ' ];
Original file line number Diff line number Diff line change @@ -161,6 +161,16 @@ public function testRouteWithSameVariableTwice()
161
161
$ compiled = $ route ->compile ();
162
162
}
163
163
164
+ /**
165
+ * @expectedException \LogicException
166
+ */
167
+ public function testRouteWithFragmentAsPathParameter ()
168
+ {
169
+ $ route = new Route ('/{_fragment} ' );
170
+
171
+ $ compiled = $ route ->compile ();
172
+ }
173
+
164
174
/**
165
175
* @dataProvider getNumericVariableNames
166
176
* @expectedException \DomainException
You can’t perform that action at this time.
0 commit comments