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-sanitization.php

    r46586 r47362  
    276276    }
    277277
     278    /**
     279     * @ticket 42961
     280     */
     281    public function test_type_object_accepts_empty_string() {
     282        $this->assertEquals( array(), rest_sanitize_value_from_schema( '', array( 'type' => 'object' ) ) );
     283    }
     284
    278285    public function test_type_unknown() {
    279286        $schema = array(
Note: See TracChangeset for help on using the changeset viewer.