ZF-12189: Zend_File_Transfer_Adapter_Abstract wrong validation when file is not send

Issue Type: Bug Created: 2012-05-08T11:35:05.000+0000 Last Updated: 2012-08-07T20:23:29.000+0000 Status: Open Fix version(s): Reporter: Nick ten Cate (nicktc) Assignee: Frank Brückner (frosch) Tags: - Zend_File_Transfer

  • Zend_Form

Related issues: - ZF-12358




I have a Zend_Form that has an Zend_Form_Element_File element, the element is not required. But when I submit the form when the Zend_Form_Element_File is hidden by JS or CSS (display:none) the file is not send as part of the $_FILES array. This is as expected. But Zend_File_Transfer_Adapter_Abstract still tries to validate the file, which is impossible because it's not sent and because it was set as not required it should not be checked. Somehow it's not looking at the ignoreNoFile (which is set to true for this not required file) option of the file.

The problem is that the isValid() function uses _getFiles() to check the files. _getFiles() is returning an empty array if the expected file is not submitted, and because of that the validation returns false. No error message is being set though.

The following patch is working for me, but I didn't test it very well yet. The patch was made in the isValid function inside Zend_File_Transfer_Adapter_Abstract.


<pre class="highlight">
$check = $this->_getFiles($files, false, true);
if (empty($check)) {
    return false;


<pre class="highlight">
$check = $this->_getFiles($files, false, true);
if (empty($check)) {
    if ($this->_options['ignoreNoFile']) {
        return true;
    return false;


Posted by Nick ten Cate (nicktc) on 2012-05-21T12:12:37.000+0000

I am new to Zend's issue tracker, but is it normal that issues remain untouched for several weeks? Can I expect a follow up on this issue?

Posted by Frank Brückner (frosch) on 2012-05-21T13:07:13.000+0000

Hi Nick, at the moment there are two main tasks:

  • working on the 1.12 release
  • working on the new shiny version 2 of the Zend Framework

I'll look at this issue, but you can also help with a patch and some unit tests for this issue. (You must send the CLA to Zend!)

(Another reason why there was no or only a late feedback: the component maintainer Thomas works no longer for the Zend Framework project.)

Posted by Stephane Mennesson (smennesson) on 2012-08-07T20:23:29.000+0000

The patch proposed by Nick is also working for me. But I can't tell if this will cause a side effect on some other parts of the component.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.