Page MenuHomePhabricator

ApiResult validation should work around PHP bug 45959
Closed, ResolvedPublic


When testing the patch for T91455, I noticed that the JSON output has duplicated all the numbered subkeys of the "params" item. This also occurs on the current TemplateData master.

Further investigation reveals that PHP is incredibly stupid when casting objects with integral keys to arrays: the array then has integral strings as keys, which can't be accessed via the [] operator (but do work with foreach), and assigning creates a new key with an integer key while leaving the integral-string key in place.

This was filed upstream as PHP bug 45959, where it was closed as "if we document it, then we can claim it's not a bug anymore". So we'd better work around the undesired behavior.

Event Timeline

Anomie claimed this task.
Anomie raised the priority of this task from to Needs Triage.
Anomie updated the task description. (Show Details)
Anomie added a project: MediaWiki-API.
Anomie added a subscriber: Anomie.

Change 264138 had a related patch set uploaded (by Anomie):
API: Work around PHP bug 45959

Change 264138 merged by jenkins-bot:
API: Work around PHP bug 45959