From 4bb9d8207f76b8760ee0023790065273b5a44a12 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 29 Oct 2017 13:47:23 -0400 Subject: [PATCH] Fixing a bug where non-existent classes would cause issues --- .../Command/ContainerDebugCommand.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index 810c9972b559d..21d1e6d3c9976 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -238,7 +238,18 @@ public function filterToServiceTypes($serviceId) return false; } - // see if the class exists (only need to trigger autoload once) - return class_exists($serviceId) || interface_exists($serviceId, false); + // if the id has a \, assume it is a class + if (false !== strpos($serviceId, '\\')) { + return true; + } + + try { + $r = new \ReflectionClass($serviceId); + + return true; + } catch (\ReflectionException $e) { + // the service id is not a valid class/interface + return false; + } } }