Skip to content

Commit

Permalink
Merge pull request #2300 from codeigniter4/remapcheck
Browse files Browse the repository at this point in the history
[ci skip] Routes collector for toolbar should not die when a method name is calculated through _remap
  • Loading branch information
lonnieezell committed Oct 4, 2019
2 parents 93a2193 + 3aa7eff commit 2192c0e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion system/Debug/Toolbar/Collectors/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,25 @@ public function display(): array
$route = $router->getMatchedRoute();

// Get our parameters
$method = is_callable($router->controllerName()) ? new \ReflectionFunction($router->controllerName()) : new \ReflectionMethod($router->controllerName(), $router->methodName());
// Closure routes
if (is_callable($router->controllerName()))
{
$method = new \ReflectionFunction($router->controllerName());
}
else
{
try
{
$method = new \ReflectionMethod($router->controllerName(), $router->methodName());
}
catch (\ReflectionException $e)
{
// If we're here, the method doesn't exist
// and is likely calculated in _remap.
$method = new \ReflectionMethod($router->controllerName(), '_remap');
}
}

$rawParams = $method->getParameters();

$params = [];
Expand Down

0 comments on commit 2192c0e

Please sign in to comment.