[wp-trac] [WordPress Trac] #60014: REST endpoint: Output "server errors" if WP_DEBUG = true (register_rest_route)

WordPress Trac noreply at wordpress.org
Thu Jan 4 17:06:00 UTC 2024


#60014: REST endpoint: Output "server errors" if WP_DEBUG = true
(register_rest_route)
-------------------------+---------------------------
 Reporter:  ecc          |       Owner:  spacedmonkey
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  6.5
Component:  REST API     |     Version:  6.4
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  rest-api
-------------------------+---------------------------
Changes (by spacedmonkey):

 * owner:  (none) => spacedmonkey
 * status:  new => assigned
 * milestone:  Awaiting Review => 6.5


Comment:

 I put together my own [https://github.com/WordPress/wordpress-
 develop/pull/5840 PR].

 This is a simply PR that just shows error data if WP_DEBUG_DISPLAY is
 defined.

 The output looks like this.

 {{{#!php
 {
     "code": "internal_server_error",
     "message": "<p>There has been a critical error on this
 website.</p><p><a href=\"https://wordpress.org/documentation/article/faq-
 troubleshooting/\">Learn more about troubleshooting WordPress.</a></p>",
     "data": {
         "status": 500,
         "error": {
             "type": 4,
             "message": "syntax error, unexpected '}'",
             "file": "/var/www/src/wp-content/mu-plugins/test.php",
             "line": 5
         }
     },
     "additional_errors": []
 }

 }}}

 This seems like a simple and clean solution. @ecc what you think?

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


More information about the wp-trac mailing list