From 87fcb7be0db8c32ecdca039a3316e98a75f923dd Mon Sep 17 00:00:00 2001 From: mychidarko Date: Wed, 20 Nov 2024 00:47:52 +0000 Subject: [PATCH] fix: filter out real middleware from rogues in stack --- src/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Router.php b/src/Router.php index 0bd10d0..d2dcc1b 100644 --- a/src/Router.php +++ b/src/Router.php @@ -824,7 +824,7 @@ private static function handle(?array $routes = null, bool $quitAfterRun = false // hacky solution to handle middleware catching all middleware with pattern (.*?) $routesToRun = array_filter($routeToHandle, function ($route) use ($uri) { - return $route['route']['pattern'] === $uri || $route['route']['pattern'] === '/.*'; + return $route['route']['pattern'] === $uri || $route['route']['pattern'] === '/.*' || implode('/', $route['params'] ?? []) === ltrim($uri, '/'); }); if (empty($routesToRun)) {