[wp-trac] [WordPress Trac] #42452: filter_rest_url_for_leading_slash assertion is broken

WordPress Trac noreply at wordpress.org
Tue Nov 7 07:26:54 UTC 2017


#42452: filter_rest_url_for_leading_slash assertion is broken
--------------------------+-----------------------------
 Reporter:  rmccue        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 This is originally from https://github.com/WP-API/WP-API/issues/2424

 The test checks if `rest_url()` was called with a leading slash and fails
 if it wasn't. This is broken because WordPress core itself calls
 `rest_url()` with no leading slashes in a few places (notably,
 `WP_REST_Posts_Controller::prepare_links`).

 This is never surfaced in core, because the test only fails if
 `permalink_structure` is set, which it isn't in the tests. Third-party
 tests which use this base class and which set a permalink structure will
 fail (unless they're on multisite, in which case the test is bypassed
 anyway).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42452>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list