[wp-trac] [WordPress Trac] #39473: get_routes() called multiple times within single REST request causing the rest_endpoints() filter to also fire more than once

WordPress Trac noreply at wordpress.org
Tue Jan 17 07:45:44 UTC 2017


#39473: get_routes() called multiple times within single REST request causing the
rest_endpoints() filter to also fire more than once
------------------------------------+------------------------------
 Reporter:  ruud@…                  |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  REST API                |     Version:  4.4
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------

Comment (by jnylen0):

 I'm not worried about this. Code really shouldn't rely on `get_routes`
 being recomputed, and I'm not aware of any that does.  But if there is a
 need to do this in the future, said "interesting" code can call
 `set_route_map( null )`.

 We should also remove the extra level of indentation and most of the
 whitespace changes in this patch by switching the conditional around:

 {{{#!php
 if ( ! empty( $endpoints ) ) {
     return $endpoints;
 }
 }}}

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


More information about the wp-trac mailing list