Home » Mail » Mail » Bug #584
Mail::mail fails on PHP 4.2.2
Details
| Submitted | 2004-01-15 13:52 UTC |
|---|---|
| From | eln at gmx dot net |
| Assigned | jon |
| Status | Closed |
| Package | |
| PHP Version | Irrelevant |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-01-15 13:52 UTC] eln at gmx dot net
Description:
------------
Using Mail with "mail" fails when using PHP 4.2.2 because of the last parameter to mail(). (As far as I have understood, you support PHP 4.2.2 even thought it's not listed in the box above.)
In addition, it's returning a boolean instead of PEAR::Error as the manual says it should do.
It is simple to fix: If the last parameter is empty, simply do not use it at all.
You can find a patch here:
http://ununique.net/div/mail.php.diff
It checks if there is any $params and if there isn't, do not use the last parameter. It also fixes the problem with returning false instead of PEAR::Error on failure.
Note that this is a possible BC - if people rely on it returning false instead of PEAR::Error, the code will not work as expected.
Safe mode is turned off.
Reproduce code:
---------------
// Using PHP 4.2.2
$pmail =& Mail::factory("mail");
$mailres = $pmail->send($address, $message["headers"], $message["body"]);
Expected result:
----------------
$mailres should be true
Actual result:
--------------
$mailres is false because mail() fails with the 5th parameter.