Make WordPress Core


Ignore:
Timestamp:
04/06/2016 09:01:11 PM (9 years ago)
Author:
markjaquith
Message:

REST API: Deliver parameters unadulterated instead of slashed.

We goofed, and parameters accessed through the REST API's methods
were slashed (inconsistently, even). This unslashes the data, so
you get the un-messed-with data that was sent.

Props joehoyle.
Fixes #36419.

File:
1 edited

Legend:

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

    r37041 r37163  
    304304        $request = new WP_REST_Request( $_SERVER['REQUEST_METHOD'], $path );
    305305
    306         $request->set_query_params( $_GET );
    307         $request->set_body_params( $_POST );
     306        $request->set_query_params( wp_unslash( $_GET ) );
     307        $request->set_body_params( wp_unslash( $_POST ) );
    308308        $request->set_file_params( $_FILES );
    309         $request->set_headers( $this->get_headers( $_SERVER ) );
     309        $request->set_headers( $this->get_headers( wp_unslash( $_SERVER ) ) );
    310310        $request->set_body( $this->get_raw_data() );
    311311
Note: See TracChangeset for help on using the changeset viewer.