From 3aa7eff7f13b475932f6deb2620c6c71fc386c30 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Thu, 3 Oct 2019 22:26:27 -0500 Subject: [PATCH] [ci skip] Routes collector for toolbar should not die when a method name is calculated through remap. Fixes #2277 --- system/Debug/Toolbar/Collectors/Routes.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/system/Debug/Toolbar/Collectors/Routes.php b/system/Debug/Toolbar/Collectors/Routes.php index aecbc327e569..ce242d01bc2d 100644 --- a/system/Debug/Toolbar/Collectors/Routes.php +++ b/system/Debug/Toolbar/Collectors/Routes.php @@ -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 = [];