[wp-trac] [WordPress Trac] #61061: PHP Warning with invalid JSON input

WordPress Trac noreply at wordpress.org
Fri May 3 05:50:11 UTC 2024


#61061: PHP Warning with invalid JSON input
--------------------------+------------------------------
 Reporter:  dd32          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  low           |   Milestone:  Awaiting Review
Component:  REST API      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  rest-api
--------------------------+------------------------------

Comment (by dd32):

 Of course, this is actually a valid JSON input.

 These are also valid, and produce the same result.
 {{{
 curl https://example.org/wp-json/wp/v2/users/1 --data '"foobar"' -H
 'Content-Type: application/json'
 curl https://example.org/wp-json/wp/v2/users/1 --data '1' -H 'Content-
 Type: application/json'
 }}}

 It seems that the expected outcome here is to simply skip sanitisation of
 the param, ultimately a missing field should be picked up by the schema of
 the API endpoint, and the endpoint may expect/handle a string/numeric
 input in the field.

 See attached.

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


More information about the wp-trac mailing list