[wp-trac] [WordPress Trac] #35666: Add support for HTTP response codes to wp_send_json_error(), wp_send_json_success(), and wp_send_json

WordPress Trac noreply at wordpress.org
Sat Sep 3 07:09:25 UTC 2016


#35666: Add support for HTTP response codes to wp_send_json_error(),
wp_send_json_success(), and wp_send_json
-------------------------+--------------------------
 Reporter:  johnbillion  |       Owner:  johnbillion
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  4.7
Component:  Formatting   |     Version:  3.5
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+--------------------------
Changes (by westonruter):

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


Comment:

 I've found a defect with the changes here. Namely, if `status_header()`
 was being called previously to `wp_send_json()`, then the default
 `$status_header` of `200` would clobber the `status_header()` that was
 first set. In other words, this breaks backwards compatibility.

 On a related note, I also found that `_ajax_wp_die_handler` was clobbering
 the `status_header()` call if output buffering is on (since
 `headers_sent()` would be `false`). See [attachment:35666.3.diff].

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


More information about the wp-trac mailing list