Make use of the compiled regex when filtering routes by path, to account for default values and regex filters on placeholders.

8.0.x
Larry Garfield 2012-09-12 21:35:22 -05:00 committed by effulgentsia
parent 8306c5a32a
commit fac9b6ed0e
1 changed files with 4 additions and 1 deletions

View File

@ -57,7 +57,10 @@ class PathMatcher implements InitialMatcherInterface {
$collection = new RouteCollection();
foreach ($routes as $name => $route) {
$collection->add($name, unserialize($route));
$route = unserialize($route);
if (preg_match($route->compile()->getRegex(), $path, $matches)) {
$collection->add($name, $route);
}
}
if (!count($collection->all())) {