[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 19:37: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
-------------------------+---------------------------

Comment (by ecc):

 @spacedmonkey I just added your PR to my WordPress installation and tested
 it.

 Your implementation works fine.

 If i send my API request with Content-Type application/json, the error
 looks like the one below.


 {{{
 {
     "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": 1,
             "message": "Uncaught TypeError:
 PluginConfig::getWpOptionStorageName(): Return value must be of type
 array, string returned in ...",
             "file": "PluginConfig.php",
             "line": 124
         }
     },
     "additional_errors": []
 }
 }}}

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


More information about the wp-trac mailing list