[wp-trac] [WordPress Trac] #44534: wp_debug_mode() does not turn off display_errors for REST requests

WordPress Trac noreply at wordpress.org
Mon Oct 15 02:19:21 UTC 2018


#44534: wp_debug_mode() does not turn off display_errors for REST requests
--------------------------+------------------------
 Reporter:  chrisl27      |       Owner:  earnjam
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  5.0
Component:  REST API      |     Version:  4.5
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  rest-api
--------------------------+------------------------

Comment (by earnjam):

 [attachment:"44534.2.diff"] adds a simple `wp_is_json_request()` function,
 which does a basic check for the `Content-Type:application/json` header.
 This function is then called inside `wp_debug_mode()`.

 Even with this, it could still be helpful to have `wp_debug_mode()` be
 called again later in the request (like in [attachment:"44534.diff"]), in
 case the `Content-Type` header is not supplied.

 I've also opened a PR to test this out within Gutenberg here:
 https://github.com/WordPress/gutenberg/pull/10606

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


More information about the wp-trac mailing list