Make WordPress Core

Changeset 35514


Ignore:
Timestamp:
11/04/2015 09:22:21 PM (11 years ago)
Author:
wonderboymusic
Message:

REST API: in WP_REST_Server::dispatch(), move preg_match() out of it's current loop, which doesn't affect the context passed to it.

Props TobiasBg.
Fixes #34488.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r35353 r35514  
    764764
    765765                foreach ( $this->get_routes() as $route => $handlers ) {
     766                        $match = preg_match( '@^' . $route . '$@i', $path, $args );
     767
     768                        if ( ! $match ) {
     769                                continue;
     770                        }
     771
    766772                        foreach ( $handlers as $handler ) {
    767773                                $callback  = $handler['callback'];
    … …  
    769775
    770776                                if ( empty( $handler['methods'][ $method ] ) ) {
    771                                         continue;
    772                                 }
    773 
    774                                 $match = preg_match( '@^' . $route . '$@i', $path, $args );
    775 
    776                                 if ( ! $match ) {
    777777                                        continue;
    778778                                }
Note: See TracChangeset for help on using the changeset viewer.