Issues

ZF-5801: Form bug when form-name and element-name is equal.

Description

<?php

// // If foo == bar (eg. form name and element name are equal) and the form is sent without any content (empty) and the standard code for validation is in place (see below) // ____________________________________________________ // if (!$this->_request->isPost()) { // return; // }

// if (!$form->isValid($this->_request->getPost())){ // $form->populate($this->_request->getPost()); // return; // } // ____________________________________________________ // then "array" will be the value of the textarea when the erroneous form is shown. // The problem goes away if foo != bar.

class BugExampleForm extends Zend_Form {

public function init()
{        
    $this->setName('foo');

    $element = new Zend_Form_Element_Textarea('bar');
    $element->setLabel('test')
        ->setRequired(true)
        ->setAttrib('rows','1')
        ->setAttrib('cols','1');

    $this->addElements(array($element));

}

}

Comments

Fixed in [ZF-9348]

Reopened because suggested fix is not reviewed and committed yet.

Matthew Weier O'Phinney resolved [ZF-9348] Patch applied to trunk and 1.10 release branch.