Issues

ZF-6897: Zend_File_Transfer_Adapter_Abstract: Internal file entry created by setDestination() is not seen by _getFiles()

Description

Bug introduced in r14161

Code to reproduce:


$adapter = new Zend_File_Transfer_Adapter_Http();

$adapter->setDestination('/tmp', 'some_file');
$adapter->getDestination('some_file');

{panel:bgColor=#FFFFCE|borderStyle=solid} Warning: Exception caught by form: "some_file" not found by file transfer adapter Stack Trace: #0 /ZF/library/Zend/File/Transfer/Adapter/Abstract.php(1033): Zend_File_Transfer_Adapter_Abstract->_getFiles('some_file', false) {panel}

The 'name' attribute is not created by setDestination() however by promoting its verification before the attempt to match the array key first, the file is skipped and never found.

Comments

Proposed patch

Of course the name attribute is not created. It is given by Zend_Form. And when you want to get something which is not available, throwing an exception is correct.

Fixed with r15884. Note that your patch introduces a BC break and does not cover unittests. We did therefor not integrate it.

Thank you.

The patch was based on our understanding of the way access to $this->_files was supposed to be encapsulated. Namely that _getFiles() is the only read accessor but the access rules are more relaxed than that apparently.

So long as the issue is fixed ... ;-)

Keep up the good work!