diff --git a/core/lib/Drupal/Core/Routing/MatcherDumper.php b/core/lib/Drupal/Core/Routing/MatcherDumper.php index 18e864f..f651323 100644 --- a/core/lib/Drupal/Core/Routing/MatcherDumper.php +++ b/core/lib/Drupal/Core/Routing/MatcherDumper.php @@ -109,6 +109,7 @@ public function dump(array $options = array()) { 'pattern_outline', 'number_parts', 'route', + 'compiled_route', )); $names = array(); foreach ($routes as $name => $route) { @@ -128,6 +129,7 @@ public function dump(array $options = array()) { 'pattern_outline' => $compiled->getPatternOutline(), 'number_parts' => $compiled->getNumParts(), 'route' => serialize($route), + 'compiled_route' => serialize($compiled), ); $insert->values($values); } diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index cc0682a..a83f2ce 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -287,14 +287,17 @@ protected function getRoutesByPath($path) { return $collection; } - $routes = $this->connection->query("SELECT name, route FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN (:patterns) ORDER BY fit DESC, name ASC", array( + $routes = $this->connection->query("SELECT name, route, compiled_route FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN (:patterns) ORDER BY fit DESC, name ASC", array( ':patterns' => $ancestors, )) - ->fetchAllKeyed(); + ->fetchAllAssoc('name'); - foreach ($routes as $name => $route) { + foreach ($routes as $name => $data) { + $route = $data->route; $route = unserialize($route); - if (preg_match($route->compile()->getRegex(), $path, $matches)) { + /** @var \Drupal\Core\Routing\CompiledRoute $compiled */ + $compiled = unserialize($data->compiled_route); + if (preg_match($compiled->getRegex(), $path, $matches)) { $collection->add($name, $route); } } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index c1751c4..4368c99 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -818,6 +818,11 @@ function system_schema() { 'type' => 'blob', 'size' => 'big', ), + 'compiled_route' => array( + 'description' => 'A serialized CompiledRoute object', + 'type' => 'blob', + 'size' => 'big', + ), 'number_parts' => array( 'description' => 'Number of parts in this router path.', 'type' => 'int',