diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index 10c717e..c064622 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -58,7 +58,7 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa * * @var array */ - protected $serialized_routes = array(); + protected $serializedRoutes = []; /** * The current path. @@ -146,11 +146,12 @@ public function preLoadRoutes($names) { throw new \InvalidArgumentException('You must specify the route names to load'); } - $routes_to_load = array_diff($names, array_keys($this->serialized_routes)); + $routes_to_load = array_diff($names, array_keys($this->routes)); + $routes_to_load = array_diff($routes_to_load, array_keys($this->serializedRoutes)); if ($routes_to_load) { $result = $this->connection->query('SELECT name, route FROM {' . $this->connection->escapeTable($this->tableName) . '} WHERE name IN ( :names[] )', array(':names[]' => $routes_to_load)); $routes = $result->fetchAllKeyed(); - $this->serialized_routes += $routes; + $this->serializedRoutes += $routes; } } @@ -162,12 +163,14 @@ public function getRoutesByNames($names) { foreach ($names as $name) { // The specified route name might not exist or might be serialized. - if (!isset($this->routes[$name]) && isset($this->serialized_routes[$name])) { - $this->routes[$name] = unserialize($this->serialized_routes[$name]); + if (!isset($this->routes[$name]) && isset($this->serializedRoutes[$name])) { + $this->routes[$name] = unserialize($this->serializedRoutes[$name]); // Leave the variable set but free up the memory. - $this->serialized_routes[$name] = ''; + $this->serializedRoutes[$name] = ''; } } + + return array_intersect_key($this->routes, array_flip($names)); } /** @@ -296,7 +299,7 @@ public function getAllRoutes() { */ public function reset() { $this->routes = array(); - $this->serialized_routes = array(); + $this->serializedRoutes = array(); } /**