Closed
Description
Describe the bug
A controller with method other than _remap
creates error in routes toolbar collector.
CodeIgniter 4 version
CodeIgniter4 Beta 0.0.2
Affected module(s)
system\Debug\Toolbar\Collectors\Routes.php
Expected behavior, and steps to reproduce if appropriate
- Set CodeIgniter environment to development
- Rename index method to _remap in app/Controllers/Home.php
- run
You get method not exists error.
The following statement in system\Debug\Toolbar\Collectors\Routes.php:
$method = is_callable($router->controllerName()) ? new \ReflectionFunction($router->controllerName()) : new \ReflectionMethod($router->controllerName(), $router->methodName());
Calling \ReflectionMethod($router->controllerName(), $router->methodName()) without method_exists check
causes method not exists error.
Fix
$method = is_callable($router->controllerName()) ? new \ReflectionFunction($router->controllerName()) : new \ReflectionMethod($router->controllerName(), method_exists($router->controllerName(), '_remap') ? '_remap' : $router->methodName());
Metadata
Metadata
Assignees
Labels
No labels
Activity