diff --git a/src/Pecee/SimpleRouter/RouterBase.php b/src/Pecee/SimpleRouter/RouterBase.php index 248205c..e618d94 100644 --- a/src/Pecee/SimpleRouter/RouterBase.php +++ b/src/Pecee/SimpleRouter/RouterBase.php @@ -85,16 +85,21 @@ class RouterBase { $this->currentRoute = $route; - if($route instanceof RouterGroup && is_callable($route->getCallback()) && $route->matchRoute($this->request)) { + if($route instanceof RouterGroup && is_callable($route->getCallback())) { - $group = $route; + $route->renderRoute($this->request); - $group->renderRoute($this->request); - $mergedSettings = array_merge($settings, $group->getMergeableSettings()); + if($route->matchRoute($this->request)) { + + $group = $route; + + $mergedSettings = array_merge($settings, $group->getMergeableSettings()); + + // Add ExceptionHandler + if ($group->getExceptionHandler() !== null) { + $this->exceptionHandlers[] = $route; + } - // Add ExceptionHandler - if($group->getExceptionHandler() !== null) { - $this->exceptionHandlers[] = $route; } }