Zend Framework

Unnecessary call to _getTmpDir() in Zend_File_Transfer_Adapter_Abstract::getDestination()

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.6.0RC2
  • Fix Version/s: 1.6.0
  • Component/s: Zend_File_Transfer
  • Labels:
    None
  • Fix Version Priority:
    Must Have

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.

Activity

Hide
Thomas Weidner added a comment -

Fixed with r10989

Show
Thomas Weidner added a comment - Fixed with r10989
Hide
Wil Sinclair added a comment -

Updating for the 1.6.0 release.

Show
Wil Sinclair added a comment - Updating for the 1.6.0 release.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
15m
Original Estimate - 15 minutes
Remaining:
15m
Remaining Estimate - 15 minutes
Logged:
Not Specified
Time Spent - Not Specified