Page MenuHomePhabricator

opensearch_desc calls Title::getLocalURL which unstubs wgUser on wikis with a variant
Closed, ResolvedPublic

/srv/mediawiki/php-1.28.0-wmf.1/includes/session/SessionManager.php:985 BadMethodCallException
Sessions are supposed to be disabled for this entry point

opensearch_desc.php needs to return a "template" URL for Special:Search on which browsers can do a string replacement to get the actual search URL. That includes calling Title::getLocalURL which might need to replace variant parameters in the URL for variant wikis, and for that it needs to check whether the page language matches the site language. For that it needs to access $wgContLang, and that seems to be an instance of StubUserLang. Not sure how that can happen.

Event Timeline

Tgr created this task.May 16 2016, 2:30 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptMay 16 2016, 2:30 PM
Anomie added a subscriber: Anomie.May 16 2016, 4:56 PM

The line in question is Title.php line 1752

&& $wgContLang->getCode() === $this->getPageLanguage()->getCode()

It's not $wgContLang in that line that's the problem, it's $this->getPageLanguage():

public function getPageLanguage() {
    global $wgLang, $wgLanguageCode;
    if ( $this->isSpecialPage() ) {
        // special pages are in the user language
        return $wgLang;

Change 288985 had a related patch set uploaded (by Anomie):
Avoid unstubbing $wgLang in Title::getLocalURL

Change 288985 merged by jenkins-bot:
Avoid unstubbing $wgLang in Title::getLocalURL

Tgr closed this task as Resolved.Nov 22 2016, 10:25 PM
Tgr assigned this task to Anomie.
Tgr removed a project: Patch-For-Review.

Was fixed a while ago.

Aklapper removed a subscriber: Anomie.Fri, Oct 16, 5:39 PM