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

WordPress Trac noreply at wordpress.org
Thu May 21 03:34:14 UTC 2026


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

Comment (by gautam23):

 @westonruter I think this is a good improvement over the current
 implementation and it correctly fixes the large integer issue for
 canonical integer strings. My only concern is that the fallback path still
 relies on float conversion, so the function ends up using two different
 validation models depending on input shape.

 From an engineering perspective, I’d lean toward making the logic fully
 syntax-based (as in my PR) and avoiding float arithmetic entirely. That
 keeps the behavior deterministic across all magnitudes/platforms, avoids
 any remaining precision edge cases, and makes the function easier to
 reason about and test. Since REST params are commonly received as strings
 anyway, validating against an integer string format seems like the cleaner
 long-term approach to me.

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


More information about the wp-trac mailing list