Skip to content

Commit

Permalink
[DependencyInjection] Made the reference case insensitive
Browse files Browse the repository at this point in the history
The container is case insensitive so using capital letters in a reference
made it fail in some cases when checking the dependencies.
Closes #2807
  • Loading branch information
stof committed Dec 8, 2011
1 parent 848f875 commit 2c3e9ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/DependencyInjection/Reference.php
Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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');
}
}

0 comments on commit 2c3e9ad

Please sign in to comment.