[wp-trac] [WordPress Trac] #40580: rest_ensure_response() can return WP_Error object, but is consequently not checked in get_item() method

WordPress Trac noreply at wordpress.org
Mon Sep 9 03:14:06 UTC 2019


#40580: rest_ensure_response() can return WP_Error object, but is consequently not
checked in get_item() method
----------------------------------------+----------------------
 Reporter:  ruud@…                      |       Owner:  (none)
     Type:  enhancement                 |      Status:  closed
 Priority:  normal                      |   Milestone:
Component:  REST API                    |     Version:  4.7
 Severity:  normal                      |  Resolution:  wontfix
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+----------------------
Changes (by TimothyBlynJacobs):

 * keywords:  has-patch dev-feedback needs-unit-tests => has-patch needs-
     unit-tests
 * status:  new => closed
 * type:  defect (bug) => enhancement
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 Hi Rudd,

 After discussing this during the REST API Office Hours, I'm going to close
 out this ticket.

 Though `rest_ensure_response` does have that documentation, the return
 type should actually be referenced from the `prepare_item_for_response`
 method and filter which intentionally only allow for a valid
 `WP_REST_Response` object to be returned.

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


More information about the wp-trac mailing list