Nikerabbit has uploaded a new change for review.
https://gerrit.wikimedia.org/r/68004
Change subject: Avoid exceptions by first checking language code validity
......................................................................
Avoid exceptions by first checking language code validity
Bug: 49423
Change-Id: I3fd98ba08393856311a48fa40769027460c72ef9
---
M languages/Language.php
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/04/68004/1
diff --git a/languages/Language.php b/languages/Language.php
index 92ea75c..00f654b 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -385,6 +385,12 @@
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' );
}
--
To view, visit https://gerrit.wikimedia.org/r/68004
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fd98ba08393856311a48fa40769027460c72ef9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits