[wp-trac] [WordPress Trac] #65271: REST API Integer Type Check Fails on Large Ints

WordPress Trac noreply at wordpress.org
Wed May 20 16:45:02 UTC 2026


#65271: REST API Integer Type Check Fails on Large Ints
--------------------------------------+-----------------------------
 Reporter:  kevinfodness              |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  REST API                  |     Version:  5.5
 Severity:  minor                     |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------

Comment (by siliconforks):

 Replying to [comment:14 mboynes]:
 > The real problem is that 2^53^ is the line after which double-precision
 floats can no longer represent every integer exactly, as @gautam23
 mentioned above.

 I don't think that really has anything to do with `rest_is_integer()`
 though.

 In general, `rest_is_integer()` should be able to handle values above
 2^53^ without problems:

 {{{
 $ wp eval 'var_dump(rest_is_integer(2**53));'
 bool(true)
 $ wp eval 'var_dump(rest_is_integer(2**54));'
 bool(true)
 $ wp eval 'var_dump(rest_is_integer(2**55));'
 bool(true)
 }}}

 I think the issue with `rest_is_integer()` is just that PHP's `round()`
 function mangles certain values.

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


More information about the wp-trac mailing list