[wp-trac] [WordPress Trac] #25692: Update /info/ API endpoints

WordPress Trac noreply at wordpress.org
Mon Oct 28 04:16:04 UTC 2013


#25692: Update /info/ API endpoints
-----------------------------+------------------
 Reporter:  johnbillion      |       Owner:
     Type:  enhancement      |      Status:  new
 Priority:  normal           |   Milestone:  3.8
Component:  Upgrade/Install  |     Version:  3.7
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------
Changes (by dd32):

 * keywords:  has-patch =>


Comment:

 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
 [attachment:25692.layer.diff]

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25692#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list