From: Niklas Laxström Date: Thu, 5 Aug 2010 16:40:50 +0000 (+0000) Subject: Fail fast if given invalid input. We've had some of these in the past and they were... X-Git-Tag: 1.31.0-rc.0~35700 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=6d4b5a79f5ce0161db7257abd272bc011e70c8ee;p=lhc%2Fweb%2Fwiklou.git Fail fast if given invalid input. We've had some of these in the past and they were hard to track down. --- diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 164ff62da6..fda8181dd4 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -499,6 +499,10 @@ class MessageCache { function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) { global $wgContLanguageCode, $wgContLang; + if ( !is_string( $key ) ) { + throw new MWException( "Non-string key given" ); + } + if ( strval( $key ) === '' ) { # Shortcut: the empty key is always missing return false;