[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 21:45:54 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 danielbachhuber):

 Some relevant conversation
 [https://wordpress.slack.com/archives/C02RQC26G/p1539637276000200 in

 > danielbachhuber [2:01 PM] @earnjam Do you think `strpos(
 $_SERVER['HTTP_ACCEPT'], 'application/json' )` is reliable enough?
 > earnjam [2:02 PM] I think so. Problem is it could be anywhere in the
 header string. Could break it apart and check them one at a time, but
 wasn’t sure if that was necessary.
 > danielbachhuber [2:02 PM] Can you spend a quick 10 minutes seeing if
 there's any prior art on the web that we can follow?
 > earnjam [2:03 PM] I couldn’t think of a situation where
 `application/json` would be in the `Accept` header, but it wouldn’t
 actually want a JSON response. Unless some client just stuck it in there
 by accident. I looked a bit. Found this PEAR HTTP2 class that does MIME
 type negotiation. It breaks it apart and looks that way, but it also
 considers weighting, so needs to.
 > https://github.com/pear/HTTP2/blob/master/HTTP2.php#L208

 @duanestorey To your question, that's not a factor in this case.

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

More information about the wp-trac mailing list