diff --git a/src/Symfony/Component/DependencyInjection/Reference.php b/src/Symfony/Component/DependencyInjection/Reference.php index 89279f71570e..1517da29885a 100644 --- a/src/Symfony/Component/DependencyInjection/Reference.php +++ b/src/Symfony/Component/DependencyInjection/Reference.php @@ -35,7 +35,7 @@ class Reference */ public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $strict = true) { - $this->id = $id; + $this->id = strtolower($id); $this->invalidBehavior = $invalidBehavior; $this->strict = $strict; } diff --git a/tests/Symfony/Tests/Component/DependencyInjection/ReferenceTest.php b/tests/Symfony/Tests/Component/DependencyInjection/ReferenceTest.php index 3bf2b04116c5..83480c46f8aa 100644 --- a/tests/Symfony/Tests/Component/DependencyInjection/ReferenceTest.php +++ b/tests/Symfony/Tests/Component/DependencyInjection/ReferenceTest.php @@ -23,4 +23,10 @@ public function testConstructor() $ref = new Reference('foo'); $this->assertEquals('foo', (string) $ref, '__construct() sets the id of the reference, which is used for the __toString() method'); } + + public function testCaseInsensitive() + { + $ref = new Reference('FooBar'); + $this->assertEquals('foobar', (string) $ref, 'the id is lowercased as the container is case insensitive'); + } }