00976: Notify doesn't work if safe_mode is enabled

Summary: Notify doesn't work if safe_mode is enabled
Created: 2007-09-14 12:00
Status: Closed - fixed for 2.2.6
Category: Bug
From: tiwoc?
Priority: 54
Version: 2.1.27
OS: Apache/2.0.54 (Fedora), PHP 5.0.4

Description: If PHP's safe_mode is enabled, scripts/notify.php silently fails. This is due to the following restriction (quoted from http://www.php.net/manual/en/function.mail.php):

"The additional_parameters parameter is disabled in safe_mode and the mail() function will expose a warning message and return FALSE when used."

Possible fix: change line 179 of scripts/notify.php from

mail($m, $subject, $mbody, $NotifyHeaders, $NotifyParameters);

to the following:

mail($m, $subject, $mbody, $NotifyHeaders);

I see this bug still exists in v2.2.4. Wouldn't a better fix be to change lines 179-182

From To
      if ($NotifyParameters)
        mail($m, $subject, $mbody, $NotifyHeaders, $NotifyParameters);
        mail($m, $subject, $mbody, $NotifyHeaders);
      // try using $NotifyParameters.  If empty or attempt fail then send mail without them
      if (!$NotifyParameters || !mail($m, $subject, $mbody, $NotifyHeaders, $NotifyParameters)
        mail($m, $subject, $mbody, $NotifyHeaders);

This should work because mail() returns false if in safe_mode as of v4.2.3.

Rik Blok? July 22, 2009, at 05:51 PM