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. >> >> >
