From 6d4b5a79f5ce0161db7257abd272bc011e70c8ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Thu, 5 Aug 2010 16:40:50 +0000 Subject: [PATCH] Fail fast if given invalid input. We've had some of these in the past and they were hard to track down. --- includes/MessageCache.php | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.20.1