Skip to content

Commit

Permalink
fix: Router now throws 404 error rather than resolving allIndex in un…
Browse files Browse the repository at this point in the history
…wanted situations
  • Loading branch information
ipranjal committed Oct 31, 2020
1 parent d85c701 commit ea9cdd9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/RouterEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class RouterEngine
*/
private $dirMode = false;


/**
* Store Dirctory during dir Mode
*/
Expand Down Expand Up @@ -187,7 +188,12 @@ private function setArguments()
$classMethod = new \ReflectionMethod($controller, $this->method);
if (count($arguments) < count($classMethod->getParameters())) {
$this->error('Not enough arguments given to the method');
} else {
}
// finally fix the long awaited allIndex bug !
elseif (count($arguments) > count($classMethod->getParameters())) {
$this->error('Not able to resolve any method for'.$this->controller.'controller');
}
else {
$this->request->attributes->set('_arguments', implode(",", $arguments));
}
}
Expand Down

0 comments on commit ea9cdd9

Please sign in to comment.