r95776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95775‎ | r95776 | r95777 >
Date:13:25, 30 August 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Handle bad input gracefully in getFallback(s)For
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -3321,7 +3321,7 @@
33223322 * @return false|string
33233323 */
33243324 static function getFallbackFor( $code ) {
3325 - if ( $code === 'en' ) {
 3325+ if ( $code === 'en' || !Language::isValidBuiltInCode( $code ) ) {
33263326 return false;
33273327 } else {
33283328 $fallbacks = self::getFallbacksFor( $code );
@@ -3338,7 +3338,7 @@
33393339 * @return array
33403340 */
33413341 static function getFallbacksFor( $code ) {
3342 - if ( $code === 'en' ) {
 3342+ if ( $code === 'en' || !Language::isValidBuiltInCode( $code ) ) {
33433343 return array();
33443344 } else {
33453345 $v = self::getLocalisationCache()->getItem( $code, 'fallback' );

Status & tagging log