specialpage: Fix login crash caused by unknown language via ?uselang
authorDerick Alangi <alangiderick@gmail.com>
Fri, 25 Jan 2019 21:50:34 +0000 (22:50 +0100)
committerD3r1ck01 <alangiderick@gmail.com>
Tue, 29 Jan 2019 16:16:02 +0000 (16:16 +0000)
commit34f78a69ef058c19ecdac7290a174624ef8212ee
tree0f10188a5bb183b699d2b840aa70d943be3524b8
parent19619edf43ce63c658ebd179304f95eae56f5f7c
specialpage: Fix login crash caused by unknown language via ?uselang

Per Krinkle's comments here: T198054#4598447, it's exactly what is
happening. @Fomafix suggests we handle the exception that is been
thrown by Language::factory() when there is an invalid language code
provided. The attempt is to fix this in the central way of ever request
whether POST or GET.

We're working within a particular context, and within this request
context, we can create a language user's language object then generate
a language object. If uselang parameter is provided an invalid language
code, getLanguage in this request context will default to $wgLanguageCode
then use this code to create the user's language object. In addition,
getLanguage() invalidates cached user interface language.

Bug: T198054
Change-Id: I825fdfa882a4243ffc63c9de0d7f482e2cfb9862
includes/context/RequestContext.php
includes/specialpage/LoginSignupSpecialPage.php