http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88391

Revision: 88391
Author:   hashar
Date:     2011-05-18 20:28:44 +0000 (Wed, 18 May 2011)
Log Message:
-----------
Makes sure wgAdditionalMailParams is null in safe mode

The global is used for a call to PHP mail() function as a way to add
additional parameters.  This will cause mail() to send E_NOTICE when
using safe mode.

Since we could use the global at different places, it makes sens to
ensure it has a sane value through Setup.php

Follow up r75557

Modified Paths:
--------------
    trunk/phase3/includes/Setup.php
    trunk/phase3/includes/UserMailer.php

Modified: trunk/phase3/includes/Setup.php
===================================================================
--- trunk/phase3/includes/Setup.php     2011-05-18 20:26:10 UTC (rev 88390)
+++ trunk/phase3/includes/Setup.php     2011-05-18 20:28:44 UTC (rev 88391)
@@ -447,6 +447,12 @@
 
 $wgDeferredUpdateList = array();
 
+// We need to check for safe_mode, because mail() willl throws an E_NOTICE
+// on additional parameters
+if( !is_null($wgAdditionalMailParams) && wgIniGetBool('safe_mode') ) {
+       $wgAdditionalMailParams = null;
+}
+
 wfProfileOut( $fname . '-globals' );
 wfProfileIn( $fname . '-extensions' );
 

Modified: trunk/phase3/includes/UserMailer.php
===================================================================
--- trunk/phase3/includes/UserMailer.php        2011-05-18 20:26:10 UTC (rev 
88390)
+++ trunk/phase3/includes/UserMailer.php        2011-05-18 20:28:44 UTC (rev 
88391)
@@ -221,19 +221,11 @@
                        ini_set( 'html_errors', '0' );
                        set_error_handler( array( 'UserMailer', 'errorHandler' 
) );
 
-                       // 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 );
-                               }
+                               $sent = mail( $recip->toString(), 
self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
                        }
 
                        restore_error_handler();


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to