REST API: Correctly infer empty objects passed via query parameters.
Permit passing an empty object as the string "?obj=". The type of the passed empty argument is inferred from the registered schema. Props TimothyBlynJacobs, steffanhalv, schlessera, dd32. Fixes #42961. Built from https://develop.svn.wordpress.org/trunk@47362 git-svn-id: http://core.svn.wordpress.org/trunk@47149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a5f16272dd
commit
44e1bbef85
|
@ -1250,6 +1250,10 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
|
|||
}
|
||||
|
||||
if ( 'object' === $args['type'] ) {
|
||||
if ( '' === $value ) {
|
||||
$value = array();
|
||||
}
|
||||
|
||||
if ( $value instanceof stdClass ) {
|
||||
$value = (array) $value;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-beta2-47361';
|
||||
$wp_version = '5.4-beta2-47362';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue