diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index 0123ca0ec2e3c48647821a0da4ea150eda9a79e5..132f89631b0809fcfa36f44507878786a50a3d75 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -169,6 +169,9 @@ public function getRouteCollectionForRequest(Request $request) { if ($cached = $this->cache->get($cid)) { $this->currentPath->setPath($cached->data['path'], $request); $request->query->replace($cached->data['query']); + if ($cached->data['routes'] === FALSE) { + return new RouteCollection(); + } return $cached->data['routes']; } else { @@ -183,7 +186,7 @@ public function getRouteCollectionForRequest(Request $request) { $cache_value = [ 'path' => $path, 'query' => $query_parameters, - 'routes' => $routes, + 'routes' => $routes->count() === 0 ? FALSE : $routes, ]; $this->cache->set($cid, $cache_value, CacheBackendInterface::CACHE_PERMANENT, ['route_match']); return $routes;