ZF-2757: Zend_Form ordering not working correctly

Description

Zend_Form ordering is not working correctly -- it's not picking up the element order when rendering.

Reproduce code:


$form = new Zend_Form();

$form->addElement('submit', 'submit')->submit->setLabel('Submit')->setOrder(30);
$form->addElement('text', 'name')->name->setLabel('Name')->setOrder(10);
$form->addElement('text', 'email')->email->setLabel('E-mail')->setOrder(20);
$form->setView(new Zend_View());

echo $form;

Expected order would be name, email, submit; actual order with 1.5.0RC1 is submit, name, email.

(Reported by Amr Mostafa on fw-mvc)

Comments

Created a test case with the reproduce code above and have confirmed this issue.

Fixed in trunk and 1.5 release branch.

Please evaluate and categorize as necessary.