[wp-trac] [WordPress Trac] #51146: Error message for a non-numeric 'json' parameter in REST API

WordPress Trac noreply at wordpress.org
Thu Aug 27 02:55:55 UTC 2020


#51146: Error message for a non-numeric 'json' parameter in REST API
--------------------------------------+--------------------------------
 Reporter:  rtagliento                |       Owner:  TimothyBlynJacobs
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  5.5.1
Component:  REST API                  |     Version:  5.5
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+--------------------------------
Changes (by TimothyBlynJacobs):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"48881" 48881]:
 {{{
 #!CommitTicketReference repository="" revision="48881"
 REST API: Fix multi-type schemas with integer fields.

 In [48306] support for multi-typed schemas was improved to first detect
 the data type of the value before applying further validation. The
 `integer` data type was detected using the new `rest_is_integer` function.
 This function used logic, however, that assumed that the value had already
 passed an `is_numeric` check. This meant that if `integer` and `string`
 were both acceptable types, the value would always be considered an
 `integer` causing the later accurate type validation to fail.

 This commit fixes the `rest_is_integer` logic to include an `is_numeric`
 check.

 Props rtagliento.
 Fixes #51146.
 }}}

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


More information about the wp-trac mailing list