Make WordPress Core


Ignore:
Timestamp:
05/23/2020 02:34:38 PM (5 years ago)
Author:
ocean90
Message:

Rest API: Ensure rest_ensure_response() upgrades WP_HTTP_Response to WP_REST_Response.

An instance of WP_HTTP_Response doesn't ensure that the required methods used in WP_REST_Server::dispatch() exist, currently causing a fatal error.

Props ali11007, TimothyBlynJacobs, ocean90.
Fixes #49495.

File:
1 edited

Legend:

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

    r47351 r47849  
    970970                 * @since 4.7.0
    971971                 *
    972                  * @param WP_HTTP_Response|WP_Error $response Result to send to the client. Usually a WP_REST_Response or WP_Error.
    973                  * @param array                     $handler  Route handler used for the request.
    974                  * @param WP_REST_Request           $request  Request used to generate the response.
     972                 * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client. Usually a WP_REST_Response or WP_Error.
     973                 * @param array                                            $handler  Route handler used for the request.
     974                 * @param WP_REST_Request                                  $request  Request used to generate the response.
    975975                 */
    976976                $response = apply_filters( 'rest_request_before_callbacks', $response, $handler, $request );
     
    10331033                 * @since 4.7.0
    10341034                 *
    1035                  * @param WP_HTTP_Response|WP_Error $response Result to send to the client. Usually a WP_REST_Response or WP_Error.
    1036                  * @param array                     $handler  Route handler used for the request.
    1037                  * @param WP_REST_Request           $request  Request used to generate the response.
     1035                 * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client. Usually a WP_REST_Response or WP_Error.
     1036                 * @param array                                            $handler  Route handler used for the request.
     1037                 * @param WP_REST_Request                                  $request  Request used to generate the response.
    10381038                 */
    10391039                $response = apply_filters( 'rest_request_after_callbacks', $response, $handler, $request );
Note: See TracChangeset for help on using the changeset viewer.