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" <themsel...@gmail.com>
To: "Zend Framework - General" <fw-general@lists.zend.com>
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.