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

Issue Type: Bug Created: 2008-08-22T11:38:36.000+0000 Last Updated: 2008-09-02T10:39:29.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Adam Jensen (jazzslider) Assignee: Thomas Weidner (thomas) Tags: - Zend_File_Transfer

Related issues: Attachments:


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.


Posted by Thomas Weidner (thomas) on 2008-08-23T15:21:59.000+0000

Fixed with r10989

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:29.000+0000

Updating for the 1.6.0 release.

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.