diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index c6586c02312aa..6936342ae6829 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -673,9 +673,15 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container * @param ContainerInterface $container The service container * * @return DelegatingLoader The loader + * + * @throws \InvalidArgumentException When the container is not an instance of ContainerBuilder */ protected function getContainerLoader(ContainerInterface $container) { + if (!$container instanceof ContainerBuilder) { + throw new \InvalidArgumentException(sprintf('The container must be an instance of Symfony\Component\DependencyInjection\ContainerBuilder, got %s.', get_class($container))); + } + $locator = new FileLocator($this); $resolver = new LoaderResolver(array( new XmlFileLoader($container, $locator),