From e23ce447443b53f10c2faa4a4223305c9b450eaa Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 26 Jun 2019 18:07:54 +0000 Subject: [PATCH] REST API: Call `WP_REST_Server::get_compact_response_links()` and `::get_raw_data()` static methods the right way. Props andizer, TimothyBlynJacobs. Fixes #47578. Built from https://develop.svn.wordpress.org/trunk@45566 git-svn-id: http://core.svn.wordpress.org/trunk@45377 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api.php | 2 +- wp-includes/rest-api/class-wp-rest-server.php | 4 ++-- wp-includes/rest-api/endpoints/class-wp-rest-controller.php | 2 +- wp-includes/version.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php index adcca17d3b..716b425e57 100644 --- a/wp-includes/rest-api.php +++ b/wp-includes/rest-api.php @@ -1395,7 +1395,7 @@ function rest_preload_api_request( $memo, $path ) { if ( 200 === $response->status ) { $server = rest_get_server(); $data = (array) $response->get_data(); - $links = $server->get_compact_response_links( $response ); + $links = $server::get_compact_response_links( $response ); if ( ! empty( $links ) ) { $data['_links'] = $links; } diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php index 0e71ef966e..252daf3e99 100644 --- a/wp-includes/rest-api/class-wp-rest-server.php +++ b/wp-includes/rest-api/class-wp-rest-server.php @@ -310,7 +310,7 @@ class WP_REST_Server { $request->set_body_params( wp_unslash( $_POST ) ); $request->set_file_params( $_FILES ); $request->set_headers( $this->get_headers( wp_unslash( $_SERVER ) ) ); - $request->set_body( $this->get_raw_data() ); + $request->set_body( self::get_raw_data() ); /* * HTTP method override for clients that can't use PUT/PATCH/DELETE. First, we check @@ -437,7 +437,7 @@ class WP_REST_Server { */ public function response_to_data( $response, $embed ) { $data = $response->get_data(); - $links = $this->get_compact_response_links( $response ); + $links = self::get_compact_response_links( $response ); if ( ! empty( $links ) ) { // Convert links to part of the data. diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-controller.php index d610504692..6188bff380 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-controller.php @@ -212,7 +212,7 @@ abstract class WP_REST_Controller { $data = (array) $response->get_data(); $server = rest_get_server(); - $links = $server->get_compact_response_links( $response ); + $links = $server::get_compact_response_links( $response ); if ( ! empty( $links ) ) { $data['_links'] = $links; diff --git a/wp-includes/version.php b/wp-includes/version.php index 26f5ee00f9..17e6504c08 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45565'; +$wp_version = '5.3-alpha-45566'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.