r88391 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88390‎ | r88391 | r88392 >
Date:20:28, 18 May 2011
Author:hashar
Status:resolved (Comments)
Tags:
Comment:
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 (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -447,6 +447,12 @@
448448
449449 $wgDeferredUpdateList = array();
450450
 451+// We need to check for safe_mode, because mail() willl throws an E_NOTICE
 452+// on additional parameters
 453+if( !is_null($wgAdditionalMailParams) && wgIniGetBool('safe_mode') ) {
 454+ $wgAdditionalMailParams = null;
 455+}
 456+
451457 wfProfileOut( $fname . '-globals' );
452458 wfProfileIn( $fname . '-extensions' );
453459
Index: trunk/phase3/includes/UserMailer.php
@@ -221,19 +221,11 @@
222222 ini_set( 'html_errors', '0' );
223223 set_error_handler( array( 'UserMailer', 'errorHandler' ) );
224224
225 - // We need to check for safe_mode, because mail() throws an E_NOTICE
226 - // on the 5th parameter when it's turned on
227 - $sm = wfIniGetBool( 'safe_mode' );
228 -
229225 if ( !is_array( $to ) ) {
230226 $to = array( $to );
231227 }
232228 foreach ( $to as $recip ) {
233 - if( $sm ) {
234 - $sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers );
235 - } else {
236 - $sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
237 - }
 229+ $sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
238230 }
239231
240232 restore_error_handler();

Follow-up revisions

RevisionCommit summaryAuthorDate
r88414wgIniGetBool -> wfIniGetBool (typo, fu 88391)hashar17:23, 19 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75557Introduced $wgAdditionalMailParams to allow adjusting extra email options. Ba...maxsem15:52, 27 October 2010

Comments

#Comment by Jack Phoenix (talk | contribs)   10:36, 19 May 2011
+if( !is_null($wgAdditionalMailParams) && wgIniGetBool('safe_mode') ) {

Typo, it should be wfIniGetBool. Also could use a bit of spacing, but that's not such a big issue.

#Comment by Hashar (talk | contribs)   17:24, 19 May 2011

Thanks for spotting this one! Typo fixed with r88414

Status & tagging log