WordPress.org

Make WordPress Core

Ticket #39042: 39042.1.diff

File 39042.1.diff, 1009 bytes (added by kkoppenhaver, 3 years ago)
  • src/wp-includes/rest-api/class-wp-rest-request.php

    diff --git src/wp-includes/rest-api/class-wp-rest-request.php src/wp-includes/rest-api/class-wp-rest-request.php
    index 3c465ba..dff6e0d 100644
    class WP_REST_Request implements ArrayAccess { 
    821821                                // if no sanitize_callback was specified, default to rest_parse_request_arg
    822822                                // if a type was specified in the args.
    823823                                if ( ! isset( $attributes['args'][ $key ]['sanitize_callback'] ) && ! empty( $attributes['args'][ $key ]['type'] ) ) {
    824                                         $attributes['args'][ $key ]['sanitize_callback'] = 'rest_parse_request_arg';
     824                                        if( ! array_key_exists('sanitize_callback', $attributes['args'][ $key ] ) ) {
     825                                                $attributes['args'][ $key ]['sanitize_callback'] = 'rest_parse_request_arg';
     826                                        }
    825827                                }
    826828                                // Check if this param has a sanitize_callback added.
    827829                                if ( ! isset( $attributes['args'][ $key ] ) || empty( $attributes['args'][ $key ]['sanitize_callback'] ) ) {