From d8c59f8f0d7150f2607488a91b1ca5a88957cc77 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Wed, 18 May 2011 20:28:44 +0000 Subject: [PATCH] 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 --- includes/Setup.php | 6 ++++++ includes/UserMailer.php | 10 +--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/includes/Setup.php b/includes/Setup.php index 3ff6eba5ad..2cd6b0a894 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -447,6 +447,12 @@ $wgArticle = null; $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' ); diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 0798c3226d..fd91d5b269 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -221,19 +221,11 @@ class UserMailer { 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(); -- 2.20.1