Skip to content

Commit f96e132

Browse files
committed
fix: prohibit CLI route with parameterized method
1 parent 2f16b45 commit f96e132

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

system/Router/AutoRouter.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ public function getRoute(string $uri, string $httpVerb): array
133133
if (is_string($handler)) {
134134
$handler = strtolower($handler);
135135

136+
// Like $routes->cli('hello/(:segment)', 'Home::$1')
137+
if (strpos($handler, '::$') !== false) {
138+
throw new PageNotFoundException(
139+
'Cannot access CLI Route: ' . $uri
140+
);
141+
}
142+
136143
if (strpos($handler, $controller . '::' . $methodName) === 0) {
137144
throw new PageNotFoundException(
138145
'Cannot access CLI Route: ' . $uri

0 commit comments

Comments
 (0)