From 5118e5e26637b3b8d0a6a956352900e02ea27014 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 26 Jun 2019 18:06:32 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@45566 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/rest-api.php | 2 +- src/wp-includes/rest-api/class-wp-rest-server.php | 4 ++-- .../rest-api/endpoints/class-wp-rest-controller.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php index adcca17d3b..716b425e57 100644 --- a/src/wp-includes/rest-api.php +++ b/src/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/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php index 0e71ef966e..252daf3e99 100644 --- a/src/wp-includes/rest-api/class-wp-rest-server.php +++ b/src/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/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php index d610504692..6188bff380 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php +++ b/src/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;