ZF-8097: getValues only returns some values when using array notation in setElementsBelongsTo

Issue Type: Bug Created: 2009-10-19T09:36:14.000+0000 Last Updated: 2010-04-16T09:43:24.000+0000 Status: Resolved Fix version(s): Reporter: Tom Graham (noginn) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: - ZF-8078

Attachments: - ZF-8097.patch


The getValues method only returns the last key in the array for sub forms of the same name. Finding it quite difficult to put into words so I will explain with a code sample.

$form = new Zend_Form();

$subForm1 = new Zend_Form_SubForm(); $subForm1->setElementsBelongTo("fields[0]"); $form->addSubForm($subForm1, "fields_0");

$subForm2 = new Zend_Form_SubForm(); $subForm2->setElementsBelongTo("fields[1]"); $form->addSubForm($subForm2, "fields_1");

After form submission and validation, the key "fields" contains only the values for $subForm2. This is because the values are merged using array_merge rather than array_merge_recursive.


Posted by Tom Graham (noginn) on 2009-10-19T09:48:37.000+0000

I have attached a patch file which includes a fix and test case for the issue.

Posted by Christian Albrecht (alab) on 2010-04-02T05:25:03.000+0000

ZF-9586 is similar, could you try if that works for you?

Posted by Christian Albrecht (alab) on 2010-04-16T09:43:24.000+0000

Resolving as duplicate of ZF-9586

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.