r70509 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70508‎ | r70509 | r70510 >
Date:16:40, 5 August 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Fail fast if given invalid input. We've had some of these in the past and they were hard to track down.
Modified paths:
  • /trunk/phase3/includes/MessageCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/MessageCache.php
@@ -499,6 +499,10 @@
500500 function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
501501 global $wgContLanguageCode, $wgContLang;
502502
 503+ if ( !is_string( $key ) ) {
 504+ throw new MWException( "Non-string key given" );
 505+ }
 506+
503507 if ( strval( $key ) === '' ) {
504508 # Shortcut: the empty key is always missing
505509 return false;

Status & tagging log