diff --git a/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php index 9faecef2f149..395d4462bce3 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php @@ -87,6 +87,10 @@ protected function addServiceInstance($id, $definition) { $class = $this->dumpValue($definition->getClass()); + if (0 === strpos($class, "'") && !preg_match('/^\'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\'$/', $class)) { + throw new \InvalidArgumentException(sprintf('"%s" is not a valid class name.', $class)); + } + $arguments = array(); foreach ($definition->getArguments() as $value) { $arguments[] = $this->dumpValue($value);