[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 14:43: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 fixed-      |     Focuses:  rest-api
  major                                          |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

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


Comment:

 In [changeset:"48883" 48883]:
 {{{
 #!CommitTicketReference repository="" revision="48883"
 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, TimothyBlynJacobs.
 Merges [48881] to the 5.5 branch.
 Fixes #51146.
 }}}

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


More information about the wp-trac mailing list