ZF-4813: ignoreNoFile Not Going to Ignore Anything!

Description

I found some similar issues, all marked as resolved, all outdated, none exactly referring to the code contained herein. This is not resolved in the current trunk [12317].

When setting a transfer adapter to ignoreNoFile, it will never listen:

Example: $uploader = $form->projectImage->getTransferAdapter(); $uploader->setOptions(array('ignoreNoFile' => true));

Here is the source of the problem, as far as I can tell:

Lines 97 & 98 of Zend_File_Transfer_Http.php [12266]:

if (!move_uploaded_file($content['tmp_name'], ($directory . $content['name']))) { if ($this->_options['ignoreNoFile']) {

The logic in the if statement will never evaluate to true as $this->_options['ignoreNoFile'] is always set to false, its default value. When using setOptions on a transfer adapter, it sets the passed options on each file. The values of the _options array are never changed. You can see this behavior where the options are set, on line 526 of Zend_File_Trasnfer_Abstract.php [12282]:

$this->_files[$key]['options'][$name] = (boolean) $value;

This fix seems to work

Change lines 98 of Zend_File_Transfer_Http.php [12266] to this:

if ($this->_files[$file]['options']['ignoreNoFile']) {

Thanks Tom!

Comments

Yes, you are right... This option has been reworked to work file based and not class wide. This one has been overseen while reworking the class.

Fixed with r12318. (thanks Tom)

Changing issues in preparation for the 1.7.0 release.