From 61f080e9392e1fb0a98ba451fd570d84507c0f39 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 10 Oct 2023 14:24:59 +0900 Subject: [PATCH] fix: reverse routing returns invalid route when '' is passed --- system/Router/RouteCollection.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 8a23264058cb..e484129a77b1 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1156,6 +1156,10 @@ public function environment(string $env, Closure $callback): RouteCollectionInte */ public function reverseRoute(string $search, ...$params) { + if ($search === '') { + return false; + } + // Named routes get higher priority. foreach ($this->routesNames as $verb => $collection) { if (array_key_exists($search, $collection)) {