We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d54f613 commit 4882913Copy full SHA for 4882913
1 file changed
system/Router/AutoRouterImproved.php
@@ -519,7 +519,15 @@ private function checkUriForMethod(string $method): void
519
return;
520
}
521
522
- if (! in_array($method, get_class_methods($this->controller), true)) {
+ // If `getSomeMethod()` exists, only `controller/some-method` should be
523
+ // accessible. But if a visitor navigates to `controller/somemethod`,
524
+ // `getSomemethod()` will be checked, and method_exists() will return true.
525
+ if (
526
+ method_exists($this->controller, $method)
527
+ // We do not permit `controller/somemethod`, so check the exact method
528
+ // name.
529
+ && ! in_array($method, get_class_methods($this->controller), true)
530
+ ) {
531
throw new PageNotFoundException(
532
'"' . $this->controller . '::' . $method . '()" is not found.'
533
);
0 commit comments