mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 07:22:01 +01:00
REST API: Exclude numeric parameters from regex parsing
The list of endpoint parameters should only include explicitly named and requested parameters. Props flixos90, rmccue, jnylen0. Fixes #40704. Built from https://develop.svn.wordpress.org/trunk@41223 git-svn-id: http://core.svn.wordpress.org/trunk@41063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
17c48865db
commit
0ef4d4289f
@ -824,12 +824,19 @@ class WP_REST_Server {
|
||||
$path = $request->get_route();
|
||||
|
||||
foreach ( $this->get_routes() as $route => $handlers ) {
|
||||
$match = preg_match( '@^' . $route . '$@i', $path, $args );
|
||||
$match = preg_match( '@^' . $route . '$@i', $path, $matches );
|
||||
|
||||
if ( ! $match ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$args = array();
|
||||
foreach ( $matches as $param => $value ) {
|
||||
if ( ! is_int( $param ) ) {
|
||||
$args[ $param ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $handlers as $handler ) {
|
||||
$callback = $handler['callback'];
|
||||
$response = null;
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-alpha-41222';
|
||||
$wp_version = '4.9-alpha-41223';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user