From: Niklas Laxström Date: Tue, 7 Jul 2015 12:44:49 +0000 (+0200) Subject: Disallow qqq as interface language X-Git-Tag: 1.31.0-rc.0~10676^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=be03b796fa570d5e8a3a15687a42a72df667b8d3;p=lhc%2Fweb%2Fwiklou.git Disallow qqq as interface language Any page on translatewiki with param setlang=qqq times out. All messages get parsed recursively until parser-template-loop-warning is reached. uselang=qqq is already ignored, see RequestContext::sanitizeLangCode. There is a counterpart to this patch in ULS, where it is changed to use Language::isSupportedLanguage. Bug: T104987 Change-Id: Ie77fe18681dfd5f9089fbaa8090dd9cc1c206da4 --- diff --git a/languages/Language.php b/languages/Language.php index 93dd239222..b698bebf43 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -254,10 +254,16 @@ class Language { * @since 1.21 */ public static function isSupportedLanguage( $code ) { - return self::isValidBuiltInCode( $code ) - && ( is_readable( self::getMessagesFileName( $code ) ) - || is_readable( self::getJsonMessagesFileName( $code ) ) - ); + if ( !self::isValidBuiltInCode( $code ) ) { + return false; + } + + if ( $code === 'qqq' ) { + return false; + } + + return is_readable( self::getMessagesFileName( $code ) ) || + is_readable( self::getJsonMessagesFileName( $code ) ); } /**