From 684ffc83e655d1e40492c42f0ac65dc192a1d8ed Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 19 Jan 2010 13:29:28 +0100 Subject: [PATCH] [DependencyInjection] added a check to ease debugging when a service id is not a string --- src/Symfony/Components/DependencyInjection/Container.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Components/DependencyInjection/Container.php b/src/Symfony/Components/DependencyInjection/Container.php index 4bddb1538a..28f66cbb60 100644 --- a/src/Symfony/Components/DependencyInjection/Container.php +++ b/src/Symfony/Components/DependencyInjection/Container.php @@ -189,6 +189,11 @@ class Container implements ContainerInterface, \ArrayAccess, \Iterator */ public function getService($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) { + if (!is_string($id)) + { + throw new \InvalidArgumentException(sprintf('A service id should be a string (%s given).', str_replace("\n", '', var_export($id, true)))); + } + if (isset($this->services[$id])) { return $this->services[$id];