diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index 06c3ea7..da9dc1b 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -333,7 +333,7 @@ public function getRoutesPaged($offset, $length = NULL) { $select = $this->connection->select($this->tableName, 'router') ->fields('router', ['name', 'route']); - if ($length) { + if (isset($length)) { $select->range($offset, $length); } diff --git a/core/modules/system/src/Tests/Routing/RouteProviderTest.php b/core/modules/system/src/Tests/Routing/RouteProviderTest.php index 6b6e1d7..be8862c 100644 --- a/core/modules/system/src/Tests/Routing/RouteProviderTest.php +++ b/core/modules/system/src/Tests/Routing/RouteProviderTest.php @@ -479,6 +479,10 @@ public function testGetRoutesPaged() { $routes = $provider->getRoutesPaged(0); $this->assertEqual(array_keys($routes), array_keys($fixture_routes)); + // Query non routes. + $routes = $provider->getRoutesPaged(0, 0); + $this->assertEqual(array_keys($routes), []); + // Query a limited sets of routes. $routes = $provider->getRoutesPaged(1, 2); $this->assertEqual(array_keys($routes), array_slice(array_keys($fixture_routes), 1, 2));