8000 [DependencyInjection] Made the reference case insensitive by stof · Pull Request #2815 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection] Made the reference case insensitive #2815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[DependencyInjection] Made the reference case insensitive
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
commit 2c3e9adcd11dff7302613fc84f1d1d4c5cb29a2b
2 changes: 1 addition & 1 deletion src/Symfony/Component/DependencyInjection/Reference.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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