From fac9b6ed0e62e609c722100c6d788c119e84c4a6 Mon Sep 17 00:00:00 2001
From: Larry Garfield <larry@garfieldtech.com>
Date: Wed, 12 Sep 2012 21:35:22 -0500
Subject: [PATCH] Make use of the compiled regex when filtering routes by path,
 to account for default values and regex filters on placeholders.

---
 core/lib/Drupal/Core/Routing/PathMatcher.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/core/lib/Drupal/Core/Routing/PathMatcher.php b/core/lib/Drupal/Core/Routing/PathMatcher.php
index a5f007c804be..a1ef5f71f506 100644
--- a/core/lib/Drupal/Core/Routing/PathMatcher.php
+++ b/core/lib/Drupal/Core/Routing/PathMatcher.php
@@ -57,7 +57,10 @@ public function matchRequestPartial(Request $request) {
 
     $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())) {
-- 
GitLab