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.

Built from https://develop.svn.wordpress.org/trunk@48308


git-svn-id: http://core.svn.wordpress.org/trunk@48077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
TimothyBlynJacobs 2020-07-05 01:06:02 +00:00
parent e6f620570d
commit 0386c0ae6c
2 changed files with 3 additions and 13 deletions

View File

@ -236,18 +236,8 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
return true;
}
if ( is_array( $support ) ) {
if ( ! $args['variadic'] ) {
$support = $support[0];
}
// Multi-type theme-support schema definitions always list boolean first.
if ( is_array( $schema['type'] ) && 'boolean' === $schema['type'][0] ) {
// Pass the non-boolean type through to the sanitizer, which cannot itself
// determine the intended type if the value is invalid (for example if an
// object includes non-safelisted properties). See #50300.
$schema['type'] = $schema['type'][1];
}
if ( is_array( $support ) && ! $args['variadic'] ) {
$support = $support[0];
}
return rest_sanitize_value_from_schema( $support, $schema );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48307';
$wp_version = '5.5-alpha-48308';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.