Make WordPress Core

Opened 6 months ago

Last modified 5 months ago

#25692 new enhancement

Update /info/ API endpoints

Reported by: johnbillion Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.7
Component: Upgrade/Install Keywords:
Focuses: Cc:


The /info/ API endpoints need to be updated to use JSON encoding.

Previously: #25311

Attachments (3)

25692plugin-install.diff (1.4 KB) - added by DaveAl 6 months ago.
25692theme.diff (1.5 KB) - added by DaveAl 6 months ago.
25692.layer.diff (1.7 KB) - added by dd32 6 months ago.

Download all attachments as: .zip

Change History (6)

DaveAl6 months ago

DaveAl6 months ago

comment:1 DaveAl6 months ago

  • Keywords has-patch added

comment:2 dd326 months ago

  • Keywords has-patch removed

This isn't as simply as switching serialize() to json_encode() (and vice versa) unfortunately.

JSON doesn't support associative arrays, which the API makes use of, all associative arrays are encoded as JSON objects.
PHP's json_decode() has support to decode all objects to associative arrays as a result, but unfortunately the API makes use of both objects and associative arrays, so using that breaks the API response format

Unfortunately this means there's only really a few options:

  1. Keep it as PHP serialized data
  2. Break compatibility and change the output/input of plugins_api() and themes_api()
  3. Add some code to selectively convert some arrays to objects in the response depending on the $args present
  4. Use something other than JSON that supports all the PHP datatypes
  5. Use our own superset of JSON on top of PHP's superset of JSON (PHP JSON supports more than the JSON standard, such as bools/nulls)

more on #5, it'd be us adding a wrapper around json_decode() and json_encode() and walking over the returned arrays and if a object item is present converting it to an object, something like 25692.layer.diff

dd326 months ago

comment:3 dd325 months ago

  • Milestone changed from 3.8 to Future Release
Note: See TracTickets for help on using tickets.