bug #40802 [FrameworkBundle] Fix array controller link in debug:router (fancyweb)

This PR was merged into the 5.2 branch.

Discussion
----------

[FrameworkBundle] Fix array controller link in debug:router

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

`debug:router` is broken when you add a route in the Kernel (see https://symfony.com/doc/current/configuration/micro_kernel_trait.html) because `kernel` is not a class and triggers a `\ReflectionException`. The code in the exception handling always expect `$controller` to be a string.

Commits
-------

be964bdfa6 [FrameworkBundle] Fix array controller link in debug:router
This commit is contained in:
Nicolas Grekas 2021-04-16 19:21:25 +02:00
commit 449c60f9aa

View File

@ -554,6 +554,10 @@ class TextDescriptor extends Descriptor
$r = new \ReflectionFunction($controller);
}
} catch (\ReflectionException $e) {
if (\is_array($controller)) {
$controller = implode('::', $controller);
}
$id = $controller;
$method = '__invoke';