[wp-trac] [WordPress Trac] #64926: REST API: GET requests fail object/array schema validation when params are JSON-serialized strings

WordPress Trac noreply at wordpress.org
Wed Apr 1 10:35:13 UTC 2026


#64926: REST API: GET requests fail object/array schema validation when params are
JSON-serialized strings
-------------------------+-------------------------------------------------
 Reporter:  dsmy         |       Owner:  (none)
     Type:  defect       |      Status:  new
  (bug)                  |
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  REST API     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  javascript, rest-api, php-
                         |  compatibility
-------------------------+-------------------------------------------------

Comment (by abcd95):

 IMO, placing the decode at the top of the function misses `anyOf/oneOf`
 schemas with no top-level type, and the $type resolves to `''` and the
 block is skipped on the initial call. It only works because recursive
 calls from rest_find_any_matching_schema() re-enter with the sub-schema's
 type set.

 Moving the decode inside the switch (validation) and before
 rest_sanitize_array()/rest_sanitize_object() (sanitization) ensures it
 fires after type resolution, regardless of schema.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64926#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list