Make WordPress Core

Changeset 48308


Ignore:
Timestamp:
07/05/2020 01:04:30 AM (3 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Remove specific multi-type schema handling from the themes controller.

Multi-type schema handling was improved in [48306]. In particular, it now allows for sanitizing a multi-typed value that wouldn't validate. Removing this handling will make 3rd party registered theme features more robust.

Fixes #50562.

File:
1 edited

Legend:

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

    r48189 r48308  
    237237        }
    238238
    239         if ( is_array( $support ) ) {
    240             if ( ! $args['variadic'] ) {
    241                 $support = $support[0];
    242             }
    243 
    244             // Multi-type theme-support schema definitions always list boolean first.
    245             if ( is_array( $schema['type'] ) && 'boolean' === $schema['type'][0] ) {
    246                 // Pass the non-boolean type through to the sanitizer, which cannot itself
    247                 // determine the intended type if the value is invalid (for example if an
    248                 // object includes non-safelisted properties). See #50300.
    249                 $schema['type'] = $schema['type'][1];
    250             }
     239        if ( is_array( $support ) && ! $args['variadic'] ) {
     240            $support = $support[0];
    251241        }
    252242
Note: See TracChangeset for help on using the changeset viewer.