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/tests/phpunit/tests/rest-api/rest-schema-validation.php

    r46586 r47362  
    289289    }
    290290
     291    /**
     292     * @ticket 42961
     293     */
     294    public function test_type_object_allows_empty_string() {
     295        $this->assertTrue( rest_validate_value_from_schema( '', array( 'type' => 'object' ) ) );
     296    }
     297
    291298    public function test_type_unknown() {
    292299        $schema = array(
Note: See TracChangeset for help on using the changeset viewer.