Page MenuHomePhabricator

QuickSurveys\Hooks::onResourceLoaderRegisterModules() depends on request data
Closed, ResolvedPublic


The load.php endpoint is not supposed to depend on session data, however QuickSurveys's hook for ResourceLoaderRegisterModules depends on the language of $wgUser.

SessionManager.php line 190 calls MediaWiki\Session\SessionManager->getSessionFromInfo()
WebRequest.php line 664 calls MediaWiki\Session\SessionManager->getSessionForRequest()
User.php line 1174 calls WebRequest->getSession()
User.php line 384 calls User->loadFromSession()
User.php line 5087 calls User->load()
User.php line 2705 calls User->loadOptions()
RequestContext.php line 368 calls User->getOption()
StubObject.php line 204 calls RequestContext->getLanguage()
StubObject.php line 160 calls StubUserLang->_newObject()
StubObject.php line 104 calls StubObject->_unstub()
StubObject.php line 179 calls StubObject->_call()
MessageCache.php line 822 calls StubUserLang->__call()
MessageCache.php line 767 calls MessageCache->getMessageFromFallbackChain()
Message.php line 1148 calls MessageCache->get()
Message.php line 771 calls Message->fetchMessage()
Message.php line 874 calls Message->toString()
ExternalSurvey.php line 48 calls Message->plain()
SurveyFactory.php line 133 calls QuickSurveys\ExternalSurvey->__construct()
SurveyFactory.php line 73 calls QuickSurveys\SurveyFactory::factoryExternal()
- line - calls QuickSurveys\SurveyFactory::factory()
QuickSurveys.hooks.php line 136 calls array_map()
QuickSurveys.hooks.php line 109 calls QuickSurveys\Hooks::getEnabledSurveys()
Hooks.php line 195 calls QuickSurveys\Hooks::onResourceLoaderRegisterModules()
ResourceLoader.php line 254 calls Hooks::run()
load.php line 44 calls ResourceLoader->__construct()
load.php line 3 calls include()

If the surveys aren't supposed to depend on the user's language, you could just use ->inContentLanguage() on the Message object. Otherwise, you might use the 'MakeGlobalVariablesScript' hook instead or use the language from the ResourceLoaderContext.

Event Timeline

Change 272888 had a related patch set uploaded (by Gergő Tisza):
Avoid unstubbing wgUser when an external survey is defined

Change 272888 merged by jenkins-bot:
Avoid unstubbing wgUser when an external survey is defined

bd808 assigned this task to Tgr.