r41288 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41287‎ | r41288 | r41289 >
Date:17:25, 26 September 2008
Author:simetrical
Status:old (Comments)
Tags:
Comment:
Raise E_USER_WARNING if bad option passed to wfMsgExt()
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -689,6 +689,15 @@
690690 $options = array($options);
691691 }
692692
 693+ foreach( $options as $option ) {
 694+ if( !in_array( $option, array( 'parse', 'parseinline', 'escape',
 695+ 'escapenoentities', 'replaceafter', 'parsemag', 'content',
 696+ 'language' ) ) ) {
 697+ trigger_error( "wfMsgExt called with incorrect parameter $option",
 698+ E_USER_WARNING );
 699+ }
 700+ }
 701+
693702 if( in_array('content', $options) ) {
694703 $forContent = true;
695704 $langCode = true;

Comments

#Comment by Brion VIBBER (talk | contribs)   23:20, 2 October 2008

Hmm, I think I'd rather just throw an exception here. Any reason to choose a funky error instead?

#Comment by Simetrical (talk | contribs)   23:26, 2 October 2008

Mainly because people complained about when I made make*Link*() throw exceptions on bad input when previously they had failed silently, and that broke the site unnecessarily. This has been failing silently for ages now, and making it fail messily is probably going to break stuff, quite possibly stuff that actually works but is being caught incorrectly by the check.

Fail fast is nice and all, but not on production sites, unless you're worried that proceeding might corrupt data or something. Devs mostly use error_reporting( E_ALL | E_STRICT ), and I hope sysadmins check the error log? so problems shouldn't survive too long.

#Comment by Tim Starling (talk | contribs)   04:57, 11 October 2008

Fine by me.

Status & tagging log