Page MenuHomePhabricator

WikimediaMessagesHooks::onMobileLicenseLink() unstubs $wgUser during ResourceLoaderGetConfigVars hook
Closed, ResolvedPublic

Description

Found while testing fix for T127860: MobileFrontend using ResourceLoaderGetConfigVars hook with User dependent data locally:

2016-02-23 20:21:48 wiki exception ERROR: [911d102a] /w/load.php?debug=false&lang=en&modules=startup&only=scripts&skin=vector   BadMethodCallException from line 960 of /vagrant/mediawiki/includes/session/SessionManager.php: Sessions are disabled for this entry point {"exception_id":"911d102a"}
[Exception BadMethodCallException] (/vagrant/mediawiki/includes/session/SessionManager.php:960) Sessions are disabled for this entry point
  #0 /vagrant/mediawiki/includes/session/SessionManager.php(187): MediaWiki\Session\SessionManager->getSessionFromInfo(MediaWiki\Session\SessionInfo, WebRequest)
  #1 /vagrant/mediawiki/includes/WebRequest.php(664): MediaWiki\Session\SessionManager->getSessionForRequest(WebRequest)
  #2 /vagrant/mediawiki/includes/user/User.php(1175): WebRequest->getSession()
  #3 /vagrant/mediawiki/includes/user/User.php(384): User->loadFromSession()
  #4 /vagrant/mediawiki/includes/user/User.php(5093): User->load()
  #5 /vagrant/mediawiki/includes/user/User.php(2706): User->loadOptions()
  #6 /vagrant/mediawiki/includes/context/RequestContext.php(368): User->getOption(string)
  #7 /vagrant/mediawiki/includes/StubObject.php(204): RequestContext->getLanguage()
  #8 /vagrant/mediawiki/includes/StubObject.php(160): StubUserLang->_newObject()
  #9 /vagrant/mediawiki/includes/StubObject.php(104): StubObject->_unstub(string, integer)
  #10 /vagrant/mediawiki/includes/StubObject.php(179): StubObject->_call(string, array)
  #11 /vagrant/mediawiki/includes/cache/MessageCache.php(824): StubUserLang->__call(string, array)
  #12 /vagrant/mediawiki/includes/cache/MessageCache.php(767): MessageCache->getMessageFromFallbackChain(StubUserLang, string, boolean)
  #13 /vagrant/mediawiki/includes/Message.php(1148): MessageCache->get(string, boolean, StubUserLang)
  #14 /vagrant/mediawiki/includes/Message.php(771): Message->fetchMessage()
  #15 /vagrant/mediawiki/includes/Message.php(874): Message->toString()
  #16 /vagrant/mediawiki/extensions/WikimediaMessages/WikimediaMessages.hooks.php(137): Message->plain()
  #17 /vagrant/mediawiki/includes/Hooks.php(195): WikimediaMessagesHooks::onMobileLicenseLink(string, string, array, string)
  #18 /vagrant/mediawiki/extensions/MobileFrontend/includes/MobileFrontend.skin.hooks.php(100): Hooks::run(string, array)
  #19 /vagrant/mediawiki/extensions/MobileFrontend/includes/MobileFrontend.hooks.php(436): MobileFrontendSkinHooks::getLicense(string)
  #20 /vagrant/mediawiki/includes/Hooks.php(195): MobileFrontendHooks::onResourceLoaderGetConfigVars(array)
  #21 /vagrant/mediawiki/includes/resourceloader/ResourceLoaderStartUpModule.php(109): Hooks::run(string, array)
  #22 /vagrant/mediawiki/includes/resourceloader/ResourceLoaderStartUpModule.php(370): ResourceLoaderStartUpModule->getConfigSettings(DerivativeResourceLoaderContext)
  #23 /vagrant/mediawiki/includes/resourceloader/ResourceLoaderModule.php(707): ResourceLoaderStartUpModule->getDefinitionSummary(DerivativeResourceLoaderContext)
  #24 /vagrant/mediawiki/includes/resourceloader/ResourceLoader.php(622): ResourceLoaderModule->getVersionHash(DerivativeResourceLoaderContext)
  #25 [internal function]: Closure$ResourceLoader::getCombinedVersion(string)
  #26 /vagrant/mediawiki/includes/resourceloader/ResourceLoader.php(623): array_map(Closure$ResourceLoader::getCombinedVersion;1299315079, array)
  #27 /vagrant/mediawiki/includes/resourceloader/ResourceLoader.php(675): ResourceLoader->getCombinedVersion(ResourceLoaderContext, array)
  #28 /vagrant/mediawiki/load.php(43): ResourceLoader->respond(ResourceLoaderContext)
  #29 /var/www/w/load.php(5): include(string)
 #30 {main}

$wgUser is unstubbed due to the wfMessage() call in WikimediaMessagesHooks::onMobileLicenseLink() which does not specify a content language. Since this is done inside the ResourceLoaderGetConfigVars hook it should not vary on user.

Details

Related Gerrit Patches:
mediawiki/extensions/WikimediaMessages : wmf/1.27.0-wmf.14Avoid unstubbing $wgUser in ResourceLoaderGetConfigVars hook
mediawiki/extensions/WikimediaMessages : masterAvoid unstubbing $wgUser in ResourceLoaderGetConfigVars hook

Event Timeline

bd808 created this task.Feb 23 2016, 8:37 PM
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptFeb 23 2016, 8:37 PM

Change 272819 had a related patch set uploaded (by BryanDavis):
Avoid unstubbing $wgUser in ResourceLoaderGetConfigVars hook

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

Change 272819 merged by jenkins-bot:
Avoid unstubbing $wgUser in ResourceLoaderGetConfigVars hook

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

Change 272832 had a related patch set uploaded (by Gergő Tisza):
Avoid unstubbing $wgUser in ResourceLoaderGetConfigVars hook

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

Change 272832 merged by jenkins-bot:
Avoid unstubbing $wgUser in ResourceLoaderGetConfigVars hook

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

Krinkle closed this task as Resolved.Feb 24 2016, 1:39 AM