Page MenuHomePhabricator

[GlobalTitleFail] RequestContext::getTitle called by MobileContext::isBlacklistedPageInternal with no title set.
Closed, ResolvedPublic

Description

Something is calling MobileContext::isBlacklistedPageInternal() too early, causing it to read from $wgTitle.

(Not sure which version of MF this is coming from, putting it under stable for now)

Event Timeline

Legoktm raised the priority of this task from to Needs Triage.
Legoktm updated the task description. (Show Details)
Legoktm added a project: MobileFrontend-stable.
Legoktm changed Security from none to None.
Legoktm added a subscriber: Legoktm.

MobileFrontendHooks::onRequestContextCreateSkin() is the culprit. The RequestContextCreateSkin hook is typically called 3 times on page load. The 3rd call is the one that is breaking. At that time, $wgTitle is set to 'API', but the RequestContext doesn't have an actual title set.

<3 ApiHelp:

#0 /vagrant/mediawiki/extensions/MobileFrontend/includes/MobileContext.php(459): MobileContext->isBlacklistedPageInternal()
#1 /vagrant/mediawiki/extensions/MobileFrontend/includes/MobileFrontend.hooks.php(155): MobileContext->isBlacklistedPage()
#2 /vagrant/mediawiki/includes/Hooks.php(209): MobileFrontendHooks::onSkinTemplateOutputPageBeforeExec(SkinApi, SkinApiTemplate)
#3 /vagrant/mediawiki/includes/skins/SkinTemplate.php(464): Hooks::run(string, array)
#4 /vagrant/mediawiki/includes/skins/SkinTemplate.php(230): SkinTemplate->prepareQuickTemplate()
#5 /vagrant/mediawiki/includes/OutputPage.php(2261): SkinTemplate->outputPage()
#6 /vagrant/mediawiki/includes/api/ApiHelp.php(54): OutputPage->output()
#7 /vagrant/mediawiki/includes/api/ApiMain.php(1028): ApiHelp->execute()
#8 /vagrant/mediawiki/includes/api/ApiMain.php(397): ApiMain->executeAction()
#9 /vagrant/mediawiki/includes/api/ApiMain.php(368): ApiMain->executeActionWithErrorHandling()
#10 /vagrant/mediawiki/api.php(84): ApiMain->execute()
#11 /var/www/w/api.php(5): include(string)
#12 {main}

I'm tempted to just plug this with an entry point check, but instead I would argue that the API just shoudn't execute a crapload of UI code.

kaldari renamed this task from [GlobalTitleFail] RequestContext::getTitle called by MobileContext::isBlacklistedPageInternal/ContextSource::getTitle/RequestContext::getTitle with no title set. to [GlobalTitleFail] RequestContext::getTitle called by MobileContext::isBlacklistedPageInternal with no title set..Mar 14 2015, 12:38 AM
kaldari triaged this task as Medium priority.
kaldari added a project: MediaWiki-API.

I'm tempted to just plug this with an entry point check, but instead I would argue that the API just shoudn't execute a crapload of UI code.

Why shouldn't the API be able to use OutputPage to output nicely formatted HTML?

Change 196738 had a related patch set uploaded (by Anomie):
Set main RequestContext title in api.php

https://gerrit.wikimedia.org/r/196738

Change 196738 merged by jenkins-bot:
Set main RequestContext title in api.php

https://gerrit.wikimedia.org/r/196738

Umherirrender assigned this task to Anomie.
Umherirrender added a subscriber: Umherirrender.