Make WordPress Core


Ignore:
Timestamp:
02/25/2020 03:32:27 PM (5 years ago)
Author:
kadamwhite
Message:

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.

File:
1 edited

Legend:

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

    r47224 r47362  
    12511251
    12521252    if ( 'object' === $args['type'] ) {
     1253        if ( '' === $value ) {
     1254            $value = array();
     1255        }
     1256
    12531257        if ( $value instanceof stdClass ) {
    12541258            $value = (array) $value;
Note: See TracChangeset for help on using the changeset viewer.