[wp-trac] [WordPress Trac] #35629: Fix link handling in WP_REST_Server->embed_links()

WordPress Trac noreply at wordpress.org
Wed Jan 27 16:36:52 UTC 2016


#35629: Fix link handling in WP_REST_Server->embed_links()
-----------------------------+------------------
 Reporter:  danielbachhuber  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  4.5
Component:  REST API         |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------
Description changed by danielbachhuber:

Old description:

> While fixing one bug, I ran into another.
>
> 1. Convert WP_Error to WP_REST_Response in WP_REST_Server->embed_links().
> Later on `WP_REST_Server->response_to_data()` expects to always receive
> `WP_REST_Response`. With the current code, a `WP_Error` object returned
> from `dispatch()` inside of `embed_links()` would fatal, because
> `WP_Error` doesn't implement the same methods as `WP_REST_Response`
> 2. Properly support non-pretty permalink REST routes.
> `http://example.org/?rest_route=%2Ftest%2Ftest%2Fembeddable&error=1`
> won't be embedded because it doesn't match
> `http://example.org/?rest_route=/`

New description:

 While fixing one bug, I ran into another.

 1. Convert WP_Error to WP_REST_Response in WP_REST_Server->embed_links().
 Later on `WP_REST_Server->response_to_data()` expects to always receive
 `WP_REST_Response`. With the current code, a `WP_Error` object returned
 from `dispatch()` inside of `embed_links()` would fatal, because
 `WP_Error` doesn't implement the same methods as `WP_REST_Response`
 2. Properly support non-pretty permalink REST routes.
 `http://example.org/?rest_route=%2Ftest%2Ftest%2Fembeddable&error=1` won't
 be embedded because it doesn't match `http://example.org/?rest_route=/`

 Related https://github.com/WP-API/WP-API/issues/2109

--

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


More information about the wp-trac mailing list