PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail » Bug #19

Mail_mail::send() fails with safe mode switched on

Details

Submitted2003-09-17 14:54 UTC
Fromchristof dot roduner at npocom dot ch
Assignedchagenbu
StatusClosed
PackageMail
PHP Version4.3.3
OSLinux
Roadmaps(Not assigned)

Comments

[2003-09-17 14:54 UTC] christof dot roduner at npocom dot ch

Description:
------------
If safe mode is switched on, Mail_mail::send() will fail with the following error message:

Warning: mail(): SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE.

The problem occurs even though only a backend driver, but no params are passed to the factory method.

Here's a patch that fixed the problem for me:

--- mail.php~ Wed Sep 17 16:09:02 2003
+++ mail.php Wed Sep 17 16:14:47 2003
@@ -109,7 +109,12 @@
// flatten the headers out.
list(,$text_headers) = Mail::prepareHeaders($headers);

- return mail($recipients, $subject, $body, $text_headers, $this->_params);
+ // Only pass fifth parameter to mail() if safe mode is off.
+ if (ini_get('safe_mode') == '1') {
+ return mail($recipients, $subject, $body, $text_headers);
+ } else {
+ return mail($recipients, $subject, $body, $text_headers, $this->_params);
+ }
}

}

Best regards,

Christof

[2003-09-18 14:44 UTC] chagenbu at php dot net

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.

In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.

Thank you for the report, and for helping us make PHP better.