merged branch aderuwe/issue-5477 (PR #5478)

Commits
-------

690e28e Convert parameter name to lowercase when removing an element from ParameterBag

Discussion
----------

[DependencyInjection] Convert parameter name to lowercase when removing an element from ParameterBag

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #5477
License of the code: MIT

---------------------------------------------------------------------------

by sstok at 2012-09-10T08:42:30Z

👍

---------------------------------------------------------------------------

by fabpot at 2012-09-10T09:28:16Z

Shouldn't it be done on the 2.0 branch?

---------------------------------------------------------------------------

by stloyd at 2012-09-10T09:29:35Z

@fabpot AFAIK `2.0` don't have `ParameterBag#remove()` method

---------------------------------------------------------------------------

by aderuwe at 2012-09-10T09:29:52Z

The remove method is not present in 2.0.

On Mon, Sep 10, 2012 at 11:28 AM, Fabien Potencier <notifications@github.com
> wrote:

> Shouldn't it be done on the 2.0 branch?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/symfony/symfony/pull/5478#issuecomment-8418300>.
>
>
This commit is contained in:
Fabien Potencier 2012-09-10 11:46:45 +02:00
commit 487b8c1bbb
2 changed files with 3 additions and 1 deletions

View File

@ -135,7 +135,7 @@ class ParameterBag implements ParameterBagInterface
*/
public function remove($key)
{
unset($this->parameters[$key]);
unset($this->parameters[strtolower($key)]);
}
/**

View File

@ -54,6 +54,8 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
));
$bag->remove('foo');
$this->assertEquals(array('bar' => 'bar'), $bag->all(), '->remove() removes a parameter');
$bag->remove('BAR');
$this->assertEquals(array(), $bag->all(), '->remove() converts key to lowercase before removing');
}
/**