8000 [FrameworkBundle] Fix array controller link in debug:router · symfony/symfony@f7e059c · GitHub
[go: up one dir, main page]

Skip to content

Commit f7e059c

Browse files
committed
[FrameworkBundle] Fix array controller link in debug:router
1 parent 255283c commit f7e059c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,15 @@ private function formatControllerLink($controller, string $anchorText, callable
541541
if (null === $controller) {
542542
return $anchorText;
543543
} elseif (\is_array($controller)) {
544-
$r = new \ReflectionMethod($controller[0], $controller[1]);
544+
try {
545+
$r = new \ReflectionMethod($controller[0], $controller[1]);
546+
} catch (\ReflectionException $e) {
547+
if ('kernel' !== $controller[0] || !$getContainer || !\is_string($kernelClass = $getContainer()->getDefinition('kernel')->getClass())) {
548+
throw $e;
549+
}
550+
551+
$r = new \ReflectionMethod($kernelClass, $controller[1]);
552+
}
545553
} elseif ($controller instanceof \Closure) {
546554
$r = new \ReflectionFunction($controller);
547555
} elseif (method_exists($controller, '__invoke')) {
@@ -554,6 +562,10 @@ private function formatControllerLink($controller, string $anchorText, callable
554562
$r = new \ReflectionFunction($controller);
555563
}
556564
} catch (\ReflectionException $e) {
565+
if (!\is_string($controller)) {
566+
return $anchorText;
567+
}
568+
557569
$id = $controller;
558570
$method = '__invoke';
559571

0 commit comments

Comments
 (0)