File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -519,10 +519,17 @@ private function checkUriForMethod(string $method): void
519519 return ;
520520 }
521521
522- if (! in_array ($ method , get_class_methods ($ this ->controller ), true )) {
523- throw new PageNotFoundException (
524- '" ' . $ this ->controller . ':: ' . $ method . '()" is not found. '
525- );
522+ // 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 (method_exists ($ this ->controller , $ method )) {
526+ // We do not permit `controller/somemethod`, so check the exact method
527+ // name.
528+ if (! in_array ($ method , get_class_methods ($ this ->controller ), true )) {
529+ throw new PageNotFoundException (
530+ '" ' . $ this ->controller . ':: ' . $ method . '()" is not found. '
531+ );
532+ }
526533 }
527534 }
528535
You can’t perform that action at this time.
0 commit comments