Make WordPress Core

Ticket #38593: 38593.diff

File 38593.diff, 938 bytes (added by joehoyle, 9 years ago)
  • src/wp-includes/rest-api/class-wp-rest-request.php

    diff --git a/src/wp-includes/rest-api/class-wp-rest-request.php b/src/wp-includes/rest-api/class-wp-rest-request.php
    index 9c5410a..bd74899 100644
    a b class WP_REST_Request implements ArrayAccess { 
    800800                                continue;
    801801                        }
    802802                        foreach ( $this->params[ $type ] as $key => $value ) {
     803                                // if no sanitize_callback was specified, default to rest_parse_request_arg
     804                                // if a type was specified in the args.
     805                                if ( ! isset( $attributes['args'][ $key ]['sanitize_callback'] ) && ! empty( $attributes['args'][ $key ]['type'] ) ) {
     806                                        $attributes['args'][ $key ]['sanitize_callback'] = 'rest_parse_request_arg';
     807                                }
    803808                                // Check if this param has a sanitize_callback added.
    804809                                if ( ! isset( $attributes['args'][ $key ] ) || empty( $attributes['args'][ $key ]['sanitize_callback'] ) ) {
    805810                                        continue;