Issues

ZF-4813: ignoreNoFile Not Going to Ignore Anything!

Issue Type: Bug Created: 2008-11-05T19:56:49.000+0000 Last Updated: 2008-11-13T14:09:58.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Adam Kosecki (adamkosecki) Assignee: Thomas Weidner (thomas) Tags: - Zend_File_Transfer

Related issues: Attachments:

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

Posted by Thomas Weidner (thomas) on 2008-11-05T22:46:40.000+0000

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)

Posted by Wil Sinclair (wil) on 2008-11-13T14:09:58.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts