Issues

ZF-5363: Zend_File_Transfer_Adapter_Abstract does not handle file uploads when no file is uploaded

Description

Zend_File_Transfer_Adapter_Abstract does not handle file uploads when no file is uploaded by the user.

Example code

$f = new Zend_Form();
$f->addElement('file', 'photo', array(
    'label' => 'photo',
    'required'=> false
))
  ->addElement('submit', 'save', array('label' => 'btn_save'));

if($_POST && $f->isValid($_POST)) {
  echo 'valid';
}

echo $f->render(new Zend_View());

Exception is thrown when form is submitted: "photo" not found by file transfer adapter The problem is on line 572, Zend/File/Transfer/Adapter/Abstract.php, where validation does not consider option ignoreNoFile for the adapter.

Comments

I forgot the 'multipart/form-data' encoding, my bet, can be closed