Skip to content

Commit 2192c0e

Browse files
authored
Merge pull request #2300 from codeigniter4/remapcheck
[ci skip] Routes collector for toolbar should not die when a method name is calculated through _remap
2 parents 93a2193 + 3aa7eff commit 2192c0e

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

system/Debug/Toolbar/Collectors/Routes.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,25 @@ public function display(): array
8888
$route = $router->getMatchedRoute();
8989

9090
// Get our parameters
91-
$method = is_callable($router->controllerName()) ? new \ReflectionFunction($router->controllerName()) : new \ReflectionMethod($router->controllerName(), $router->methodName());
91+
// Closure routes
92+
if (is_callable($router->controllerName()))
93+
{
94+
$method = new \ReflectionFunction($router->controllerName());
95+
}
96+
else
97+
{
98+
try
99+
{
100+
$method = new \ReflectionMethod($router->controllerName(), $router->methodName());
101+
}
102+
catch (\ReflectionException $e)
103+
{
104+
// If we're here, the method doesn't exist
105+
// and is likely calculated in _remap.
106+
$method = new \ReflectionMethod($router->controllerName(), '_remap');
107+
}
108+
}
109+
92110
$rawParams = $method->getParameters();
93111

94112
$params = [];

0 commit comments

Comments
 (0)