Skip to content

Commit c2cc6d2

Browse files
committed
Applies DefaultRoute when a route is specified but doesn't match a valid route
1 parent d9bbdd5 commit c2cc6d2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ModuleJson.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function find(array $route) {
2121
$method = $this->request->server('REQUEST_METHOD');
2222

2323

24-
if (!isset($route[0]) || (isset($route[0]) && $route[0] == '')) $routeName = isset($config->$method->defaultRoute) ? $config->$method->defaultRoute : 'index';
24+
if (empty($route[0]) || !isset($config->$method->{$route[0]})) $routeName = isset($config->$method->defaultRoute) ? $config->$method->defaultRoute : 'index';
2525
else $routeName = array_shift($route);
2626

2727
if (isset($config->$method->$routeName)) {
@@ -33,8 +33,10 @@ public function find(array $route) {
3333
$matchedRoute = (object) array_merge((array)$matchedRoute, (array)$config->$inheritMethod->$routeName);
3434
}
3535

36-
return $this->getRoute($matchedRoute, $route);
3736
}
37+
38+
return $this->getRoute($matchedRoute, $route);
39+
3840
}
3941

4042
private function getRouteDir($moduleName) {

0 commit comments

Comments
 (0)