Permalink
Browse files

[Routing] added a proper exception when a route pattern references th…

…e same variable more than once (closes #3344)
  • Loading branch information...
1 parent 75ccb55 commit 30a4fa4f9163a5beba288f823b7288d571eec1f4 @fabpot fabpot committed Feb 14, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 RouteCompiler.php
View
@@ -51,6 +51,11 @@ public function compile(Route $route)
}
$tokens[] = array('variable', $match[0][0][0], $regexp, $var);
+
+ if (in_array($var, $variables)) {
+ throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $route->getPattern(), $var));
+ }
+
$variables[] = $var;
}

0 comments on commit 30a4fa4

Please sign in to comment.