From 4e35d38b33070a06eee5f72cd207de2c62c6acda Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 12 Jun 2024 09:13:32 +0900 Subject: [PATCH] fix: TypeError in DefinedRouteCollector::collect() --- system/Router/DefinedRouteCollector.php | 4 ++++ 1 file changed, 4 insertions(+) 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;