Make WordPress Core

Opened 10 years ago

Closed 4 years ago

#25692 closed enhancement (duplicate)

Update /info/ API endpoints

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.7
Component: Upgrade/Install Keywords: has-patch needs-refresh
Focuses: Cc:

Description

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 10 years ago.
25692theme.diff (1.5 KB) - added by DaveAl 10 years ago.
25692.layer.diff (1.7 KB) - added by dd32 10 years ago.

Download all attachments as: .zip

Change History (8)

@DaveAl
10 years ago

#1 @DaveAl
10 years ago

  • Keywords has-patch added

#2 @dd32
10 years 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

@dd32
10 years ago

#3 @dd32
10 years ago

  • Milestone changed from 3.8 to Future Release

#4 @chriscct7
8 years ago

  • Keywords has-patch needs-refresh added

The unit test should be moved out to the unit test suite

#5 @johnbillion
4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Fixed in [42631].

Closing as a duplicate of #29274.

Note: See TracTickets for help on using tickets.