[wp-trac] [WordPress Trac] #30613: Check the return value of wp_json_encode()
WordPress Trac
noreply at wordpress.org
Thu Feb 5 16:35:48 UTC 2015
#30613: Check the return value of wp_json_encode()
------------------------------------+-------------------------
Reporter: pento | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.2
Component: General | Version: 4.1
Severity: normal | Resolution:
Keywords: needs-docs needs-patch | Focuses: javascript
------------------------------------+-------------------------
Changes (by DrewAPicture):
* keywords: has-patch needs-docs => needs-docs needs-patch
Comment:
Replying to [comment:5 TobiasBg]:
> @DrewAPicture: What kind of docs do you have in mind here? Just
something simple like `// Sanity check.` for each of the changes?
Something like that. And it looks like there's an errant `\` on the first
line of src/wp-admin/includes/nav-menu.php in the patch.
Also, while I agree we should be doing these sanity checks, it's not
exactly DRY to be explicitly checking false and assigning `[]` all over
the place.
I realize that `wp_json_encode()` has parameter parity with
`json_encode()` but it might be worth exploring adding a fourth parameter
for the sanity check return. It would be a lot cleaner and could cover
most of these cases.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30613#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list