Skip to content

Commit a7bd063

Browse files
committed
Fixed potential bug that allows actions to be called directly by including the Action suffix, thereby bypassing the before filter
1 parent 3d6c090 commit a7bd063

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Core/Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ public function dispatch($url)
117117
$action = $this->params['action'];
118118
$action = $this->convertToCamelCase($action);
119119

120-
if (is_callable([$controller_object, $action])) {
120+
if (preg_match('/action$/i', $action) == 0) {
121121
$controller_object->$action();
122122

123123
} else {
124-
throw new \Exception("Method $action (in controller $controller) not found");
124+
throw new \Exception("Method $action in controller $controller cannot be called directly - remove the Action suffix to call this method");
125125
}
126126
} else {
127127
throw new \Exception("Controller class $controller not found");

0 commit comments

Comments
 (0)