Yep, $tmpdir is empty. That must mean none of the entire _getTmpDir method
works in my environment, at least in the context of $adapter->getFileName().
Looking over the _getTmpDir method it, I find that...
if (empty($this->_tmpDir)) {
// Attemp to detect by creating a temporary file
$tempFile = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($tempFile) {
$tmpdir = realpath(dirname($tempFile));
unlink($tempFile);
} else
{
require_once 'Zend/File/Transfer/Exception.php';
throw new Zend_File_Transfer_Exception('Could not
determine temp directory');
}
}
it enters this conditional statement, yet seems to escape it without
throwing that exception. so the tempfile check isn't working. not 100% sure
what you guys are trying to do with this check, but whatever it is, it's not
working on my server :)
On Wed, Dec 17, 2008 at 4:53 PM, Thomas Weidner <[email protected]>wrote:
> Cameron,
>
> to go further with debugging you can see that your exception is called in
> the file Abstract on line 948.
> Now simply output the destination directory on line 947 so you can see
> which directory you set.
>
> Then check if the directory which is set there
> * does exist
> * has write access
>
> Do this checks within your application as your user can have other rights
> than the webserver.
>
> I am sure you will see where the problem is.
>
> To note:
> This is default debugging strategy... there is no magic ZF action or
> knowledge necessary. :-)
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> ----- Original Message ----- From: "Cameron" <[email protected]>
> To: "Thomas Weidner" <[email protected]>
> Cc: "Zend Framework - General" <[email protected]>
> Sent: Wednesday, December 17, 2008 1:59 AM
>
> Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.
>
>
> here's the full $e.
>>
>> http://pastebin.com/m5d442e15
>>
>> the line in my code, line 83, that is definitely where it is calling
>> $adapter->getFileName().
>>
>> On Tue, Dec 16, 2008 at 7:01 PM, Thomas Weidner <[email protected]
>> >wrote:
>>
>> Cameron,
>>>
>>> when you have unexpected exceptions somewhere in your code it's always
>>> usefull to get the whole exception and not only the rethrown content.
>>>
>>> This would be really helpfull, not only for ZF but for every generic
>>> problem where exceptions are thrown.
>>>
>>> Greetings
>>> Thomas Weidner, I18N Team Leader, Zend Framework
>>> http://www.thomasweidner.com
>>>
>>> ----- Original Message ----- From: "Cameron" <[email protected]>
>>> To: "Thomas Weidner" <[email protected]>
>>> Cc: "Zend Framework - General" <[email protected]>
>>> Sent: Tuesday, December 16, 2008 10:47 AM
>>> Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.
>>>
>>>
>>>
>>> Yeah ok, so that's all a bit messy/broken, but I've cleaned it up and
>>> it's
>>>
>>>> still doing the same thing:
>>>>
>>>> here's the cleaned up code in a pastebin:
>>>>
>>>> http://pastebin.com/m5bab1a44
>>>>
>>>> the output is:
>>>>
>>>> Array ( [0] => bbbThe given destination is no directory or does not
>>>> exist
>>>> )
>>>>
>>>> To test and make sure, i reverted to 1.7.0, still works fine.
>>>>
>>>>
>>>> On Tue, Dec 16, 2008 at 5:31 PM, Thomas Weidner <[email protected]
>>>> >wrote:
>>>>
>>>> Hy Cameron,
>>>>
>>>>>
>>>>> Why should the first catch, catch anything when there is a failure ?
>>>>> According to manual, receive() returns a false on failure, not an
>>>>> exception.
>>>>>
>>>>> Also you are calling getFileName in any case, regardless if the form is
>>>>> valid or not.
>>>>>
>>>>> Greetings
>>>>> Thomas Weidner, I18N Team Leader, Zend Framework
>>>>> http://www.thomasweidner.com
>>>>>
>>>>> ----- Original Message ----- From: "Cameron" <[email protected]>
>>>>> To: "Zend Framework - General" <[email protected]>
>>>>> Sent: Tuesday, December 16, 2008 7:25 AM
>>>>> Subject: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.
>>>>>
>>>>>
>>>>>
>>>>> if ($form->isValid($formData)) {
>>>>>
>>>>> //the form is valid, finish moving the file about
>>>>>>
>>>>>> $adapter = new Zend_File_Transfer_Adapter_Http();
>>>>>> if ($adapter->isValid() === false) {
>>>>>> print_r($adapter->getMessages());
>>>>>> }
>>>>>>
>>>>>> try {
>>>>>> $adapter->setDestination($path .
>>>>>> "/$src_class/$foreign_id")
>>>>>> ->receive();
>>>>>> } catch (Exception $e) {
>>>>>> $errors[] = $e->getMessage();
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> if (!$errors) {
>>>>>> //if there are no errors with things so far, add a db
>>>>>> record.
>>>>>> try {
>>>>>> $this->_model->add(array('foreign_id' => $foreign_id,
>>>>>> 'filename' => $adapter->getFileName(), 'src_class' => $src_class,
>>>>>> 'type'
>>>>>> =>
>>>>>> $formData['newform']['type']));
>>>>>> }
>>>>>> catch (Exception $e) {
>>>>>> $errors[] = $e->getMessage();
>>>>>> }
>>>>>> }
>>>>>>
>>>>>>
>>>>>> This works perfectly with 1.7.0, fails in 1.7.1 with a really odd
>>>>>> problem
>>>>>> -
>>>>>> it doesn't fail until the SECOND catch Exception, and the error it
>>>>>> returns
>>>>>> is "The given destination is no directory or does not exist", which it
>>>>>> most
>>>>>> certainly does because the file is being uploaded and moved in to
>>>>>> place
>>>>>> just
>>>>>> fine, nor can I see how the setDestinaton method is being called by
>>>>>> the
>>>>>> getFileName method?
>>>>>> This is all a bit too weird for me, I'm not really sure what's going
>>>>>> on.
>>>>>> printing out variables as the setDestination method is being called
>>>>>> shows
>>>>>> a
>>>>>> perfectly fine path, and the file is being written... there's just
>>>>>> this
>>>>>> exception being thrown at some point. If one of you Zend guys has a
>>>>>> good
>>>>>> place for me to start debugging this one from I'm more than happy to
>>>>>> help.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>