WordPress.org

Make WordPress Core

Changeset 39061


Ignore:
Timestamp:
10/31/2016 05:07:14 PM (3 years ago)
Author:
joehoyle
Message:

REST API: Sanitize arrays being sent as CSVs.

In #38586 the ability to parse arrays as csv was introduced, however it didn't add any support for validating csv arrays. This adds such sanitization, and also a good amount of unit tests for all sanitization baed off schema.

See #38586.

Location:
trunk
Files:
1 added
1 edited

Legend:

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

    r39048 r39061  
    10981098            return (array) $value;
    10991099        }
     1100        if ( ! is_array( $value ) ) {
     1101            $value = preg_split( '/[\s,]+/', $value );
     1102        }
    11001103        foreach ( $value as $index => $v ) {
    11011104            $value[ $index ] = rest_sanitize_value_from_schema( $v, $args['items'] );
Note: See TracChangeset for help on using the changeset viewer.