mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@47362 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user