Apparently for certain (API) requests $this->getTitle() doesn't return a valid Title.
Usually these are API siteinfo requests (api.php?action=query&meta=siteinfo). In that case, this code used to produce a fatal ("Call to a member function getPageLanguage() on a non-object").
Change-Id: Ifb6f99fe554890ff2719220f58d1b6c1a7a95ddc
This commit is contained in:
parent
46f0261af0
commit
6849fde6cb
1 changed files with 6 additions and 1 deletions
|
|
@ -1889,7 +1889,12 @@ class OutputPage extends ContextSource {
|
|||
* /w/index.php?title=Main_page&variant=zh-cn should never be served.
|
||||
*/
|
||||
function addAcceptLanguage() {
|
||||
$lang = $this->getTitle()->getPageLanguage();
|
||||
$title = $this->getTitle();
|
||||
if ( !$title instanceof Title ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$lang = $title->getPageLanguage();
|
||||
if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
|
||||
$variants = $lang->getVariants();
|
||||
$aloption = array();
|
||||
|
|
|
|||
Loading…
Reference in a new issue