Issues

ZF-4034: Unnecessary call to _getTmpDir() in Zend_File_Transfer_Adapter_Abstract::getDestination()

Description

In revision 10979 of the standard trunk, line 823 of Zend_File_Transfer_Adapter_Abstract calls its _getTmpDir() method for retrieving the current system temporary directory.

However, the return value of this method is only used conditionally, in two spots in the method (lines 836-837 and line 854). If I'm reading it correctly, it's only used when the destination of a file has not been explicitly assigned.

Now, this isn't really a problem in most cases. However, in the event that _getTmpDir() fails to find an appropriate temporary directory (i.e., it throws an exception from line 885), getDestination() fails too...even if the destination of the specified file HAS been explicitly assigned previously via setDestination(). In that latter case, the temporary directory isn't even needed, but its absence is causing the whole process to fail.

Given this, it would be better to retrieve the temporary directory only when it's absolutely certain that it's necessary; i.e., right before it's used in 836-837 and 854. That way users with unusual temporary directory settings will still be able to use the adapter by explicitly setting the destination every time.

Comments

Fixed with r10989

Updating for the 1.6.0 release.