ZF-10468: getValues(true) in Zend_Form yields incorrect results after using set[Elements]Belong[s]To
Description
In a form that's configured via
$form = new Foo_Form(); // extends Zend_Form $form->setElementsBelongTo('FOO');
foreach($form->getSubForms() as $name => $subform) { foreach($subform->getElements() as $element) { $element->setBelongsTo('FOO['.$name.']'); } } if($this->getRequest()->isPost() && $this->_hasParam('FOO') && $form->isValid($_POST)) { $values = $form->getValues(true); var_dump($values); }
With 1.10.2 I get the following result: array 'Attributes' => array 'AnswerToMyQuestion' => string 'answer_to_my_question_two' (length=25)
With 1.10.8 I get the following result: array 'Attributes' => array 'FOO' => array 'Attributes' => array 'AnswerToMyQuestion' => string 'answer_to_my_question_two' (length=25)
Comments
Posted by Richard Tuin (richardtuin) on 2011-01-20T13:34:11.000+0000
The latter is expected behaviour since 1.10.4. After some research it appears this change was addressed in issue ZF-9607 (patch 6 to be precise).