[wp-trac] [WordPress Trac] #51146: After upgrade to WordPress 5.5 I got an error on using REST api

WordPress Trac noreply at wordpress.org
Wed Aug 26 17:14:23 UTC 2020


#51146: After upgrade to WordPress 5.5  I got an error on using REST api
--------------------------+--------------------------------
 Reporter:  rtagliento    |       Owner:  TimothyBlynJacobs
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  5.5.1
Component:  REST API      |     Version:  5.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  rest-api
--------------------------+--------------------------------
Changes (by TimothyBlynJacobs):

 * owner:  (none) => TimothyBlynJacobs
 * status:  new => assigned
 * milestone:  Awaiting Review => 5.5.1


Comment:

 Hi @rtagliento,

 Thanks for the report and welcome to trac!

 For reference, this is the arg definition: https://github.com/civicrm
 /civicrm-wordpress/blob/e424123d720100ac105a9ec896be1d120f5c93e4/wp-
 rest/Controller/Rest.php#L435

 This is due to [48306]. Specifically, `rest_is_integer` isn't strict
 enough. That logic is the same as was used in
 `rest_validate_value_from_schema`, but what I missed is that it was first
 validated to be `is_numeric`.

 What is happening is that `rest_is_integer` is returning true for your
 value, which means that the validator thinks the correct type to validate
 against is an integer, but it is then rejected when the `is_numeric` check
 happens.

 The fix is to add `is_numeric()` to `rest_is_integer()`.

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


More information about the wp-trac mailing list