mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@35514 git-svn-id: http://core.svn.wordpress.org/trunk@35478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9e5726c233
commit
16637eeee4
@ -763,6 +763,12 @@ class WP_REST_Server {
|
||||
$path = $request->get_route();
|
||||
|
||||
foreach ( $this->get_routes() as $route => $handlers ) {
|
||||
$match = preg_match( '@^' . $route . '$@i', $path, $args );
|
||||
|
||||
if ( ! $match ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ( $handlers as $handler ) {
|
||||
$callback = $handler['callback'];
|
||||
$response = null;
|
||||
@ -771,12 +777,6 @@ class WP_REST_Server {
|
||||
continue;
|
||||
}
|
||||
|
||||
$match = preg_match( '@^' . $route . '$@i', $path, $args );
|
||||
|
||||
if ( ! $match ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! is_callable( $callback ) ) {
|
||||
$response = new WP_Error( 'rest_invalid_handler', __( 'The handler for the route is invalid' ), array( 'status' => 500 ) );
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-beta2-35513';
|
||||
$wp_version = '4.4-beta2-35514';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user