Page MenuHomePhabricator

uselang=user on api breaks in ULS
Closed, ResolvedPublic

Description

https://en.wikipedia.org/w/api.php?uselang=user gives a error page instead of api help in the user lang. I am not sure, if this bug is in ULS or API.

If you report this error to the Wikimedia System Administrators, please include the details below.

PHP fatal error in /srv/mediawiki/php-1.25wmf5/extensions/UniversalLanguageSelector/UniversalLanguageSelector.hooks.php line 199:
Argument 3 passed to UniversalLanguageSelectorHooks::getLanguage() must be an instance of RequestContext, instance of ApiMain given


Version: master
Severity: normal

Details

Reference
bz72951

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:45 AM
bzimport set Reference to bz72951.
Anomie added a comment.Nov 4 2014, 4:09 PM

It depends on whether the $context parameter to 'UserGetLanguageObject' is really supposed to be a RequestContext, or if any IContextSource implementation should be accepted. If the former, API; if the latter, ULS and docs/hooks.txt.

I note that ULS only uses it for $context->getRequest(), so any IContextSource would do. And CentralAuth is also calling the hook while passing something that is only guaranteed to be an IContextSource (specifically whatever is returned by SpecialPage::getContext()).

Change 170938 had a related patch set uploaded by Anomie:
UserGetLanguageObject hook should accept any IContextSource

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

Change 170940 had a related patch set uploaded by Anomie:
UserGetLanguageObject hook should accept any IContextSource

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

Change 170938 merged by jenkins-bot:
UserGetLanguageObject hook should accept any IContextSource

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

Change 170944 had a related patch set uploaded by Anomie:
UserGetLanguageObject hook should accept any IContextSource

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

Change 170945 had a related patch set uploaded by Anomie:
UserGetLanguageObject hook should accept any IContextSource

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

Change 170944 merged by jenkins-bot:
UserGetLanguageObject hook should accept any IContextSource

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

Change 170945 merged by jenkins-bot:
UserGetLanguageObject hook should accept any IContextSource

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

Anomie added a comment.Nov 4 2014, 4:48 PM

The bug itself is fixed, and was backported during the SWAT window that was conveniently still open. The doc fix for hooks.txt is still outstanding, but that's just bug 1.

Change 170940 merged by jenkins-bot:
UserGetLanguageObject hook should accept any IContextSource

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