I think that in the case that a matching key or partial key exists, the name should be treated as an array. Especially the double remove behavior is quite irritating and no regular user would expect this - I took the snippet and had people fill in what they'd expect as returns and not a single person expected the current behavior. It massively contradicts the principle of least surprise. It would be a BC break, I do agree on that - however I cannot imagine the the framework itself relies on that.

cheers

felix

On Dec 11, 2008, at 4:09 PM, David Zülke wrote:

Nah, that's intentional. The idea is that you can set a literal
"foo[bar]" if you need to (and that will be returned if you get it
again instead of the entry "bar" in "foo").

Changing that would break BC; I believe; we're relying on it in a
couple of places, I think.

- David




Am 11.12.2008 um 14:47 schrieb Felix Gilcher:

Hey,

while writing the tests for #955 I stumbled over the behavior
demonstrated in this snippet:

$p = new AgaviParameterHolder();
$p->setParameter('foo', array('bar' => 'baz', 'ball' => 'round'));
$p->getParameter('foo[bar]'); // baz
$p->setParameter('foo[bar]', 'foo');
$p->getParameter('foo'); // hmm:  array('bar' => 'baz', 'ball' =>
'round'), expected: array('bar' => 'foo', 'ball' => 'round')
$p->getParameter('foo[bar]'); // foo
$p->unsetParameter('foo[bar]'); // foo
$p->getParameter('foo[bar]'); // baz !!! (instead of null)

This is triggered by AgaviParameterHolder::setParameter() not trying
to resolve array parts in the name like get/has/unsetParameter() do.
I'd call that unexpected and I'd say it's a bug - it took me nearly
15 minutes to figure out what I was doing wrong in my testcase.
However it's a bit unclear how to fix that...

Any insights?

cheers

felix



--
Felix Gilcher

Bitextender GmbH
Paul-Heyse-Str. 6
D-80336 München

T: +49 89 57 08 15 16
F: +49 89 57 08 15 17
M: +49 172 840 88 28

[EMAIL PROTECTED]
http://bitextender.com/

Amtsgericht München, HRB 174280
Geschäftsführer: David Zülke, Florian Clever

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Agavi Dev Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/dev

Reply via email to