[wp-trac] [WordPress Trac] #28786: wp_send_json silently fails on non UTF-8 strings

WordPress Trac noreply at wordpress.org
Sat Nov 1 22:26:56 UTC 2014


#28786: wp_send_json silently fails on non UTF-8 strings
------------------------------+-----------------------
 Reporter:  pento             |       Owner:  pento
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:  4.1
Component:  Formatting        |     Version:  3.5
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+-----------------------
Changes (by wonderboymusic):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Currently, `wp_json_encode()` returns false in its `try/catch` block  -
 most of the functions that it is used in or passed to expect string.

 Also problematic, if someone sets a JS var equal to the output, their code
 will explode - see
 https://github.com/WordPress/WordPress/commit/007ec52958742ed768c74f37e21e6db2b75aa32e
 #diff-aa3b133f32e8e18853fde3a700fb9a70R274

 This may not totally matter, but:
 https://scrutinizer-ci.com/g/staylor/WordPress/inspections/c68e0913-d1dd-
 4dfd-bdcf-5b2dc68e0f3c/issues/files/wp-admin/includes/ajax-
 actions.php?status=new&orderField=path&order=asc

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28786#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list