Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.7

Bug #9219 sendMailsInQueue does not return an ErrorObject
Submitted: 2006-11-02 16:55 UTC
From: ericbouwers at gmail dot com Assigned: quipo
Status: Closed Package: Mail_Queue (version 1.1.3)
PHP Version: Irrelevant OS: Windows / Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 42 - 14 = ?

 
 [2006-11-02 16:55 UTC] ericbouwers at gmail dot com (Eric Bouwers)
Description: ------------ The 'sendMailsInQueue' function in the 'Mail_Queue' will always return true. There is a call to 'PEAR::raiseError', but the result of this call is not returned. I have found: http://pear.php.net/bugs/bug.php?id=147 which explains the solution and this: 'If someone finds the time to propose a patch with an even better solution, he's welcome.' I have written down a proposal as a probable fix. This will return 'true' when everything succeeds and the latest error otherwise. Test script: --------------- Script: --- $status = $mail_queue->sendMailsInQueue($max_ammount_mails); if(PEAR::isError($status)){ echo 'Mails are not send'; } else { echo 'Mails are send'; } --- Probable fix: Add an return on line 320. === while ($mail = $this->get()) { $this->container->countSend($mail); $result = $this->sendMail($mail); if (!PEAR::isError($result)) { //if-case } else { PEAR::raiseError(/* ..options.. */); } } return true; === becomes: === $status = true; while ($mail = $this->get()) { $this->container->countSend($mail); $result = $this->sendMail($mail); if (!PEAR::isError($result)) { //if-case } else { $status = PEAR::raiseError(/* ..options.. */); } } return $status; === Expected result: ---------------- 'There was a problem' Actual result: -------------- There is an infinite loop. (see http://pear.php.net/bugs/bug.php?id=6538) But according to the code the result would be: 'Mails are send'

Comments

 [2006-11-02 16:57 UTC] ericbouwers at gmail dot com
Entered wrong email-address
 [2007-01-20 11:25 UTC] quipo (Lorenzo Alberton)
Partial fix committed to CVS. If there's an error in sendMailsInQueue(), the problematic mail is removed from the internal sending buffer, and the next mail is processed. NB: the mail is not removed from the db since it could be a temporary issue. If you want to remove it, you can do it manually with a custom error handler