[wp-trac] [WordPress Trac] #36358: Return of _wp_json_prepare_data() in wp_json_encode() should be used.
WordPress Trac
noreply at wordpress.org
Mon Mar 28 16:54:19 UTC 2016
#36358: Return of _wp_json_prepare_data() in wp_json_encode() should be used.
--------------------------+-----------------------------
Reporter: jrf | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.4
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I was looking at the `wp_json_encode()` function for unrelated reasons and
noticed a code oddity where the return of a function call to
`_wp_json_prepare_data()` which was intentionally introduced was being
disregarded.
The code was introduced in #34926 by @rmccue.
I'm including three different patches which each solve the issue in a
slightly different way.
* Patch 1 presumes that the call should only influence the `$data` for the
first `json_encode()` call.
* Patch 2 presumes that the call should influence the `$data` for both
`json_encode()` calls.
* Patch 3 presumes that the call should only influence the `$data` for the
potential second `json_encode()` call.
As I'm not 100% sure about the intended influence reach of the code, I'd
like to ask @rmccue to review the patches and decide which one should be
merged.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36358>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list