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

Description

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.

Comments

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

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

Resolving as duplicate of ZF-9586