Skip to content

Commit

Permalink
fix: filter out real middleware from rogues in stack
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Nov 20, 2024
1 parent 5815717 commit 87fcb7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 87fcb7b

Please sign in to comment.