Bug: 49423
Change-Id: I3fd98ba08393856311a48fa40769027460c72ef9
public static function isKnownLanguageTag( $tag ) {
static $coreLanguageNames;
+ // Quick escape for invalid input to avoid exceptions down the line
+ // when code tries to process tags which are not valid at all.
+ if ( !self::isValidBuiltInCode( $tag ) ) {
+ return false;
+ }
+
if ( $coreLanguageNames === null ) {
include MWInit::compiledPath( 'languages/Names.php' );
}
public static function provideUnknownLanguageTags() {
return array(
array( 'mw', 'non-existent two-letter code' ),
+ array( 'foo"<bar', 'very invalid language code' ),
);
}