[wp-trac] [WordPress Trac] #39053: Add function `wp_validate_integer`

WordPress Trac noreply at wordpress.org
Sun May 7 22:25:01 UTC 2017


#39053: Add function `wp_validate_integer`
-------------------------------------------------+-------------------------
 Reporter:  peterwilsoncc                        |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  General                              |  Release
 Severity:  normal                               |     Version:
 Keywords:  has-patch has-unit-tests needs-      |  Resolution:
  refresh                                        |     Focuses:
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):

 * milestone:  4.8 => Future Release


Comment:

 Bumping this as there is no time to do properly before 4.8.

 I've done some testing and multiplying a numeric string by 1 casts to
 either an integer for numbers below `PHP_INT_MAX`, or a float for numbers
 above.

 In terms of object IDs in core, which is where we'd use this most, I think
 having the correct value is more important than having the ideal type. It
 sure would be dandy to be able to make use of the BIG INTs we have in the
 database.

 I've chatted about this with @joehoyle at length & I know he disagrees, it
 would be good to get others thoughts and push back.

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


More information about the wp-trac mailing list