From 8a9e0f526d56d75f0991c25e7f9f7b7ce9281b0f Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sun, 4 Sep 2016 03:01:20 +0200 Subject: [PATCH] [FrameworkBundle] Check for class existence before is_subclass_of --- .../DependencyInjection/Compiler/AddConsoleCommandPass.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php index 4ab0d82ed1..7af53395f8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php @@ -38,6 +38,10 @@ class AddConsoleCommandPass implements CompilerPassInterface $class = $container->getParameterBag()->resolveValue($definition->getClass()); if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) { + if (!class_exists($class, false)) { + throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + } + throw new \InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id)); } $container->setAlias('console.command.'.strtolower(str_replace('\\', '_', $class)), $id);