PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail_Queue » Bug #9219

sendMailsInQueue does not return an ErrorObject

Details

Submitted2006-11-02 16:55 UTC
Fromericbouwers at gmail dot com
Assignedquipo
StatusClosed
PackageMail_Queue
PHP VersionIrrelevant
OSWindows / Linux
Roadmaps(Not assigned)

Comments

[2006-11-02 16:55 UTC] ericbouwers at gmail dot com

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'

[2006-11-02 16:57 UTC] ericbouwers at gmail dot com

Entered wrong email-address