Automatically remove .* .+ .? in route definition regexp #2287

This commit is contained in:
Kijin Sung 2024-03-24 22:18:55 +09:00
parent 0cc034909c
commit 289a249569

View file

@ -636,6 +636,9 @@ class Router
} }
}, $route); }, $route);
// Replace unnecessary regexp.
$route = preg_replace('/\\.[*+?]/', '', $route);
// Add a query string for the remaining arguments. // Add a query string for the remaining arguments.
return $route . (count($vars) ? ('?' . http_build_query($vars)) : ''); return $route . (count($vars) ? ('?' . http_build_query($vars)) : '');
} }