diff --git a/system/Router/DefinedRouteCollector.php b/system/Router/DefinedRouteCollector.php index 8d4f1dc5b1b7..2452a141fa75 100644 --- a/system/Router/DefinedRouteCollector.php +++ b/system/Router/DefinedRouteCollector.php @@ -38,6 +38,10 @@ public function collect(): Generator $routes = $this->routeCollection->getRoutes($method); foreach ($routes as $route => $handler) { + // The route key should be a string, but it is stored as an array key, + // it might be an integer. + $route = (string) $route; + if (is_string($handler) || $handler instanceof Closure) { if ($handler instanceof Closure) { $view = $this->routeCollection->getRoutesOptions($route, $method)['view'] ?? false;