When using safe_mode, mail() cannot take the 5th parameter. Rather than (needlessly...
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 15 Dec 2010 19:55:08 +0000 (19:55 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 15 Dec 2010 19:55:08 +0000 (19:55 +0000)
includes/DefaultSettings.php
includes/UserMailer.php

index f60eb61..3db8ece 100644 (file)
@@ -1043,6 +1043,7 @@ $wgSMTP                           = false;
 
 /**
  * Additional email parameters, will be passed as the last argument to mail() call.
+ * If using safe_mode this has no effect
  */
 $wgAdditionalMailParams = null;
 
index 91eaab7..17fd74c 100644 (file)
@@ -223,12 +223,19 @@ class UserMailer {
                        ini_set( 'html_errors', '0' );
                        set_error_handler( array( 'UserMailer', 'errorHandler' ) );
 
-                       if ( is_array( $to ) ) {
-                               foreach ( $to as $recip ) {
+                       // We need to check for safe_mode, because mail() throws an E_NOTICE
+                       // on the 5th parameter when it's turned on
+                       $sm = wfIniGetBool( 'safe_mode' );
+
+                       if ( !is_array( $to ) ) {
+                               $to = array( $to );
+                       }
+                       foreach ( $to as $recip ) {
+                               if( $sm ) {
+                                       $sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers );
+                               } else {
                                        $sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
                                }
-                       } else {
-                               $sent = mail( $to->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
                        }
 
                        restore_error_handler();