diff --git a/core/lib/Drupal/Core/Routing/PathMatcher.php b/core/lib/Drupal/Core/Routing/PathMatcher.php index a5f007c804b..a1ef5f71f50 100644 --- a/core/lib/Drupal/Core/Routing/PathMatcher.php +++ b/core/lib/Drupal/Core/Routing/PathMatcher.php @@ -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())) {