Make WordPress Core

Changeset 39089


Ignore:
Timestamp:
11/02/2016 06:01:49 AM (8 years ago)
Author:
rmccue
Message:

REST API: Avoid default sanitization for polymorphic params.

Some parameters (title, content, etc) are objects in the output, but allow objects or strings to be sent in updates for a more ergonomic interface. This is pretty weird behaviour, so the default sanitisation doesn't handle this. We instead handle this ourselves in the preparation.

Props joehoyle, rachelbaker.
Fixes #38529.

Location:
trunk/src/wp-includes/rest-api/endpoints
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r39015 r39089  
    11331133                    'type'            => 'object',
    11341134                    'context'         => array( 'view', 'edit', 'embed' ),
     1135                    'arg_options'     => array(
     1136                        'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
     1137                    ),
    11351138                    'properties'      => array(
    11361139                        'raw'         => array(
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r39084 r39089  
    18141814                        'type'        => 'object',
    18151815                        'context'     => array( 'view', 'edit', 'embed' ),
     1816                        'arg_options' => array(
     1817                            'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
     1818                        ),
    18161819                        'properties'  => array(
    18171820                            'raw' => array(
     
    18351838                        'type'        => 'object',
    18361839                        'context'     => array( 'view', 'edit' ),
     1840                        'arg_options' => array(
     1841                            'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
     1842                        ),
    18371843                        'properties'  => array(
    18381844                            'raw' => array(
     
    18701876                        'type'        => 'object',
    18711877                        'context'     => array( 'view', 'edit', 'embed' ),
     1878                        'arg_options' => array(
     1879                            'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
     1880                        ),
    18721881                        'properties'  => array(
    18731882                            'raw' => array(
Note: See TracChangeset for help on using the changeset viewer.