MAPG-69 fix routing to handle emptry string properly
This commit is contained in:
parent
df60efbb8c
commit
87d476065d
@ -9,7 +9,7 @@ if (($pos = strpos($url, '?')) !== false) {
|
||||
}
|
||||
$url = rawurldecode($url);
|
||||
|
||||
$match = Container::$routeCollection->match($method, explode('/', $url));
|
||||
$match = Container::$routeCollection->match($method, $url == '' ? [] : explode('/', $url));
|
||||
|
||||
if ($match !== null) {
|
||||
list($route, $params) = $match;
|
||||
|
@ -64,7 +64,7 @@ class RouteCollection
|
||||
throw new \Exception('Route already exists: ' . $id);
|
||||
}
|
||||
|
||||
$pattern = array_merge($this->groupStack, explode('/', $pattern));
|
||||
$pattern = array_merge($this->groupStack, $pattern === '' ? [] : explode('/', $pattern));
|
||||
$route = new Route($id, $pattern, $handler);
|
||||
|
||||
$groupNumber = count($pattern);
|
||||
|
Loading…
Reference in New Issue
Block a user