diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index a0b4384ad7f46a995573416dbc28822622c10f76..951b057e6c94377ae379c3301d360c68a8500216 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;