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:
commit
487b8c1bbb
|
@ -135,7 +135,7 @@ class ParameterBag implements ParameterBagInterface
|
|||
*/
|
||||
public function remove($key)
|
||||
{
|
||||
unset($this->parameters[$key]);
|
||||
unset($this->parameters[strtolower($key)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in New Issue