Page MenuHomePhabricator

Argument 1 passed to Title::getLanguageConverter() must be an instance of Language, instance of StubUserLang given, called in /srv/mediawiki/php-1.35.0-wmf.18/includes/Title.php on line 207
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.18

message
Argument 1 passed to Title::getLanguageConverter() must be an instance of Language, instance of StubUserLang given, called in /srv/mediawiki/php-1.35.0-wmf.18/includes/Title.php on line 207

Impact

Notes

Details

Request ID
XjnyrApAIDAAAJztHI8AAACQ
Request URL
https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.18/includes/Title.php(207): Title->getLanguageConverter(StubUserLang)
#1 /srv/mediawiki/php-1.35.0-wmf.18/includes/Title.php(3568): Title->getPageLanguageConverter()
#2 /srv/mediawiki/php-1.35.0-wmf.18/includes/MediaWiki.php(508): Title->getCdnUrls()
#3 /srv/mediawiki/php-1.35.0-wmf.18/includes/MediaWiki.php(304): MediaWiki->performAction(Article, Title)
#4 /srv/mediawiki/php-1.35.0-wmf.18/includes/MediaWiki.php(967): MediaWiki->performRequest()
#5 /srv/mediawiki/php-1.35.0-wmf.18/includes/MediaWiki.php(530): MediaWiki->main()
#6 /srv/mediawiki/php-1.35.0-wmf.18/index.php(46): MediaWiki->run()
#7 /srv/mediawiki/w/index.php(3): require(string)
#8 {main}

Related Objects

Event Timeline

Reedy triaged this task as Unbreak Now! priority.Feb 4 2020, 10:51 PM

I've been getting sporadic errors like [XjoBKQpAAD8AAIE3bO4AAAAN] 2020-02-04 23:41:29: Fatal exception of type "TypeError" after being redirected from a Special:MyLanguage subpage linked from Template:Databases on MediaWiki wiki. For instance, I clicked a link to Special:MyLanguage/Manual:Langlinks_table from the template, was redirected to Manual:Langlinks_table, and saw the error there. Reloading usually gets the page to display.

I've also gotten 503 responses directly on the Special:MyLanguage subpage.

Should we roll back group0 due to the disruption this is causing? The error rate is surprisingly high for code that's only deployed to group0.

Should we roll back group0 due to the disruption this is causing? The error rate is surprisingly high for code that's only deployed to group0.

It's pretty high as we have a lot of incoming links (and links on mw.org etc) that point to Special:MyLanguage which is broken by the patch

It looks like 61e0908fa2915d73243686c4013f0af244fbc7f2 doesn't cleanly revert on master, from gerrit it looks like maybe 3 or 4 patches ontop of it...

I don't know when CPT will necessarily get round to fixing it though

So reverting is probably the best thing at the moment

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add/rm <file>..." as appropriate to mark resolution)

	both modified:   includes/parser/LinkHolderArray.php
	both modified:   includes/parser/Parser.php
	both modified:   includes/preferences/DefaultPreferencesFactory.php
	both modified:   languages/LanguageConverter.php
	both modified:   languages/classes/LanguageEn.php
	both modified:   languages/classes/LanguageGan.php
	both modified:   languages/classes/LanguageKk.php
	both modified:   languages/classes/LanguageZh.php
	deleted by them: tests/phpunit/languages/LanguageConverterFactoryTest.php

Change 570246 had a related patch set uploaded (by Peter.ovchyn; owner: Peter.ovchyn):
[mediawiki/core@master] language: avoid using StubUserLang in favor of using RequestContext::getLanguage()

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

I've found a cause submitted a patch/hotfix. Don't think this is the best option, but reverting isn't promising to be painless also as a lot of changes are based on the top of that patch.

Both options are quite risky as this area isn't covered by tests good enough.

So at the moment I'm testing the hotfix and covering it by tests. I in this situation this way looks more preferable to me. What do you think?

Generally speaking, the removal of StubUserLang may have side effects (because RequestContext::getLanguage would be called earlier). Alternative hotfixes that I can think of are removing the typehint from Title::getLanguageConverter, or adding StubObject::unstub( $wgLang ); in Title::getPageLanguage, before returning $wgLang (this can probably be considered a medium-term solution).

Generally speaking, the removal of StubUserLang may have side effects (because RequestContext::getLanguage would be called earlier). Alternative hotfixes that I can think of are removing the typehint from Title::getLanguageConverter, or adding StubObject::unstub( $wgLang ); in Title::getPageLanguage, before returning $wgLang (this can probably be considered a medium-term solution).

Got this. At the moment I'm working on another solution: removing type hints.

WDoranWMF subscribed.

@Peter.ovchyn it's fine to remove the cpt tag once a task has moved into a sub board. thanks

Change 570246 merged by jenkins-bot:
[mediawiki/core@master] language: remove Language hints for type check as it breaks using of StubUserLang

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

Change 570377 had a related patch set uploaded (by Reedy; owner: Peter.ovchyn):
[mediawiki/core@wmf/1.35.0-wmf.18] language: remove Language hints for type check as it breaks using of StubUserLang

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

Change 570377 merged by jenkins-bot:
[mediawiki/core@wmf/1.35.0-wmf.18] language: remove Language hints for type check as it breaks using of StubUserLang

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

Mentioned in SAL (#wikimedia-operations) [2020-02-05T17:33:04Z] <reedy@deploy1001> Synchronized php-1.35.0-wmf.18/includes/: T244300 (duration: 01m 14s)

Mentioned in SAL (#wikimedia-operations) [2020-02-05T17:34:35Z] <reedy@deploy1001> Synchronized php-1.35.0-wmf.18/languages/: T244300 (duration: 01m 13s)

The problem seems to persist on beta.

The problem seems to persist on beta.

That's somewhat surprising (or did I misunderstand the nature of the problem?)

The problem seems to persist on beta.

That's somewhat surprising (or did I misunderstand the nature of the problem?)

T244370: Beta: Undefined index: 1x in /srv/mediawiki-staging/php-master/includes/Setup.php on line 186