Page MenuHomePhabricator

$data->paramOrder is null on pages edited since MediaWiki 1.33/wmf.13 was deployed
Closed, ResolvedPublic

Description

TemplateData doesn’t work on pages edited since MediaWiki 1.33/wmf.13 was deployed. Querying it fails with Argument 1 passed to ApiResult::setIndexedTagName() must be an instance of array, null given, see for example {{PD}}’s TemplateData on mediawiki.org. Using local install, I found that $data->paramOrder is not set in includes/api/ApiTemplateData.php, line 131. This bug initially seemed to affect pages actually marked for translation (i.e. not pages that have <translate> tags but not marked for translation) -- but actually seems to occur for any page edited since MediaWiki 1.33/wmf.13 was deployed.

Details

Related Gerrit Patches:
mediawiki/extensions/TemplateData : wmf/1.33.0-wmf.13ApiTemplateData: Check for $data->paramOrder being unset
mediawiki/extensions/TemplateData : masterApiTemplateData: Check for $data->paramOrder being unset

Event Timeline

Restricted Application added a project: VisualEditor. · View Herald TranscriptJan 16 2019, 6:45 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I have a hunch that TemplateData relies on some behavior that for some reason is suppressed on translatable pages, but I would be happy if someone could investigate the root cause.

JTannerWMF moved this task from To Triage to FY 19-20 on the VisualEditor board.Jan 17 2019, 4:40 PM

Maybe. But the odd thing is that it works on a non-translatable page, so it somehow magically gets back its paramOrder if the page is not translatable.

I was wrong, it also appears at https://la.wikipedia.org/w/api.php?action=templatedata&titles=Formula:Augenda, which has nothing to do with Translate. It’s just that TemplateData is not broken for pages not edited since the above change. So may this task be prioritized as “Unbreak Now” as it seems that no working TemplateData can be added to pages?

Dvorapa added a subscriber: ssastry.EditedJan 19 2019, 3:43 PM

Adding also @ssastry and @Krinkle from T138200 into the debate

From the merged task:

A GET request for https://en.wikipedia.org/w/api.php?action=templatedata&format=json&titles=Template%3AWikiProject%20India&redirects=1&doNotIgnoreMissingTitles=1 returns status 500. Loading the url in the browser shows a WMF error page with the following message:

PHP fatal error:
Argument 1 passed to ApiResult::setIndexedTagName() must be an instance of array, null given

Similar requests such as

work as expected, returning the result of the request.
The request is being made from my enwiki userscript User:Evad37/rater; I found this error while investigating an issue reported by another user.

Template:WikiProject_India has been edited since MediaWiki 1.33/wmf.13 was deployed, whereas the two working examples have not.

Evad37 renamed this task from $data->paramOrder is null on translatable pages to $data->paramOrder is null on pages edited since MediaWiki 1.33/wmf.13 was deployed.Jan 20 2019, 7:45 AM
Evad37 added a project: MediaWiki-API.
Evad37 updated the task description. (Show Details)

Although it also isn't working for Template:Infobox video game on enwiki, and the latest edit to the template (or rather its /doc subpage) was on 13 Jan, a few days before MediaWiki 1.33/wmf.13 was deployed. Reported at village pump (technical), where the failure means that VisualEditor can't display parameters or descriptions.

Krinkle triaged this task as Unbreak Now! priority.Jan 20 2019, 8:44 AM
Restricted Application added subscribers: Liuxinyu970226, TerraCodes. · View Herald TranscriptJan 20 2019, 8:44 AM
Anomie added a subscriber: Anomie.

Looks likely. Specifically, the removal at https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TemplateData/+/481811/2/includes/TemplateDataBlob.php#b431 seems to have made it possible for the paramOrder key to be null or unset, as shown by the fact that they had to add a ?? at https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TemplateData/+/481811/2/includes/TemplateDataBlob.php#794.

Probably the most straightforward fix would be to wrap the call to ApiResult::setIndexedTagName( $data->paramOrder, 'p' ) in ApiTemplateData with an if ( isset( $data->paramOrder ) ) { ... }.

Change 485492 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/extensions/TemplateData@master] ApiTemplateData: Check for $data->paramOrder being unset

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

Change 485713 had a related patch set uploaded (by Krinkle; owner: Anomie):
[mediawiki/extensions/TemplateData@wmf/1.33.0-wmf.13] ApiTemplateData: Check for $data->paramOrder being unset

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

Change 485492 merged by jenkins-bot:
[mediawiki/extensions/TemplateData@master] ApiTemplateData: Check for $data->paramOrder being unset

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

Change 485713 merged by jenkins-bot:
[mediawiki/extensions/TemplateData@wmf/1.33.0-wmf.13] ApiTemplateData: Check for $data->paramOrder being unset

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

Mentioned in SAL (#wikimedia-operations) [2019-01-21T22:33:56Z] <krinkle@deploy1001> Synchronized php-1.33.0-wmf.13/extensions/TemplateData/includes/api/ApiTemplateData.php: I7647ddfc47 - T213953 (duration: 00m 47s)

Krinkle closed this task as Resolved.Jan 21 2019, 10:44 PM
Krinkle assigned this task to Anomie.
Krinkle removed a project: Patch-For-Review.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptJan 21 2019, 10:44 PM
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM