Make WordPress Core

Ticket #40614: 40614.2.diff

File 40614.2.diff, 849 bytes (added by TimothyBlynJacobs, 5 years ago)
  • src/wp-includes/rest-api.php

    diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
    index 251c677998..eab48fe9a4 100644
    a b function rest_get_server() { 
    482482 * Ensures request arguments are a request object (for consistency).
    483483 *
    484484 * @since 4.4.0
     485 * @since 5.3.0 Accept string argument for the request path.
    485486 *
    486  * @param array|WP_REST_Request $request Request to check.
     487 * @param array|string|WP_REST_Request $request Request to check.
    487488 * @return WP_REST_Request REST request instance.
    488489 */
    489490function rest_ensure_request( $request ) {
    function rest_ensure_request( $request ) { 
    491492                return $request;
    492493        }
    493494
     495        if ( is_string( $request ) ) {
     496                return new WP_REST_Request( 'GET', $request );
     497        }
     498
    494499        return new WP_REST_Request( 'GET', '', $request );
    495500}
    496501