ZF-4323: Incorrect Zend_Form_Element_File validating & API inconsistence


Zend_Form_Element_File shows errors from other file element in when using multiple file upload fields.

UC: Form Elements: $A = new Zend_Form_Element_File('A'); $A->setLabel('A') ->addValidator(new Zend_Validate_File_Count(0, 1)) ->addValidator(new Zend_Validate_File_ImageSize());

    $B = new Zend_Form_Element_File('B');
      ->addValidator(new Zend_Validate_File_Count(0, 1));

Scenario: Upload not an image to File A field.

Result: Error in B field: File 'A' error, possible attack.

Fix: Zend_Form_Element_File::isValid line: 275 if($adapter->receive($this->getName())) { return true; }

API inconsistency: Zend_Form_Element_File::hasErrors() returns false, but getErrors() returns array with errors.


Both problem are fixed latest with r11446