Skip to content

Commit

Permalink
docs: improve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jun 24, 2024
1 parent 497b499 commit 73dd2e7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions system/Router/AutoRouterImproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,15 @@ private function checkUriForMethod(string $method): void
return;
}

// If `getSomeMethod()` exists, only `controller/some-method` should be
// accessible. But if a visitor navigates to `controller/somemethod`,
// `getSomemethod()` will be checked, and method_exists() will return true.
if (
// For example, if `getSomeMethod()` exists in the controller, only
// the URI `controller/some-method` should be accessible. But if a
// visitor navigates to the URI `controller/somemethod`, `getSomemethod()`
// will be checked, and `method_exists()` will return true because
// method names in PHP are case-insensitive.
method_exists($this->controller, $method)
// We do not permit `controller/somemethod`, so check the exact method
// name.
// But we do not permit `controller/somemethod`, so check the exact
// method name.
&& ! in_array($method, get_class_methods($this->controller), true)
) {
throw new PageNotFoundException(
Expand Down

0 comments on commit 73dd2e7

Please sign in to comment.