Page MenuHomePhabricator

Create integration test to prevent ⧼Lang⧽ from causing a fatal error
Closed, ResolvedPublic

Description

Follow-up to T259744: Argument 3 passed to CachingFallbackLabelDescriptionLookup::buildCacheKey() must be of the type string, null given

Links like https://test.wikidata.org/wiki/Module_talk:T259744?uselang=⧼Lang⧽ with a content of {{#invoke:T259744|getLabel|entity=Q11}} have caused a fatal production error like T259744. This was introduced in the context of T250930 and T259779/T259783 seem related.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

The thing that makes this a bit tricky is that a Lua call like mw.wikibase.getLabel('Q1234', '⧼Lang⧽') doesn’t produce the error, at least not in this case (edit: i. e. T259744) – the language has to come from the request context, I think.

Hm, even the scribunto-console API doesn’t reproduce the error (Wikidata shouldn’t have the fix for T259744 yet):

$ curl https://www.wikidata.org/w/api.php -d format=json -d formatversion=2 -d action=scribunto-console -d title=Module:Blank -d question="=mw.wikibase.getLabel('Q1')"; echo
{"type":"normal","print":"","return":"universe","session":1126382394,"sessionSize":27,"sessionMaxSize":500000,"sessionIsNew":""}
$ curl https://www.wikidata.org/w/api.php -d format=json -d formatversion=2 -d action=scribunto-console -d title=Module:Blank -d question="=mw.wikibase.getLabel('Q1')" -d uselang='⧼Lang⧽'; echo
{"type":"normal","print":"","return":"nil","session":512380653,"sessionSize":27,"sessionMaxSize":500000,"sessionIsNew":""}

Note that the result is different, so the uselang parameter isn’t being ignored – but it doesn’t cause an exception, either.

Hm, even the scribunto-console API doesn’t reproduce the error (Wikidata shouldn’t have the fix for T259744 yet):

Well, Wikidata is on wmf.2, where the bug doesn’t exist yet 🤦 I thought I should be able to reproduce it on Beta Wikidata, where the bug should be deployed but not the fix (because it’s only backported to wmf.3, not merged in master); but no luck:

$ curl https://wikidata.beta.wmflabs.org/w/api.php -d format=json -d formatversion=2 -d action=scribunto-console -d title=Module:Blank -d question="=mw.wikibase.getLabel('Q1')" -d uselang='⧼Lang⧽'; echo
{"type":"normal","print":"","return":"nil","session":635795326,"sessionSize":27,"sessionMaxSize":500000,"sessionIsNew":""}

Change 619302 had a related patch set uploaded (by Itamar Givon; owner: Itamar Givon):
[mediawiki/extensions/Wikibase@master] Add integration test for odd uselang param usage

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

Change 619302 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add integration test for odd uselang param usage

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

Change 619105 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] DNM: Revert "Fix CachingFallbackLabelDescriptionLookup failing in edge-cases"

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

Change 619105 abandoned by Lucas Werkmeister (WMDE):
[mediawiki/extensions/Wikibase@master] DNM: Revert "Fix CachingFallbackLabelDescriptionLookup failing in edge-cases"

Reason:

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

Verified that the test is able to detect T259744: Argument 3 passed to CachingFallbackLabelDescriptionLookup::buildCacheKey() must be of the type string, null given if the fix for that issue is reverted – see the change above (I pasted the test results into a comment).