[wp-trac] [WordPress Trac] #57205: PHP 8.1 warning : Implicit conversion from float 9.9 to int loses precision

WordPress Trac noreply at wordpress.org
Fri Jan 20 21:31:58 UTC 2023


#57205: PHP 8.1 warning : Implicit conversion from float 9.9 to int loses precision
-------------------------------------+----------------------
 Reporter:  roadlink                 |       Owner:  (none)
     Type:  defect (bug)             |      Status:  closed
 Priority:  normal                   |   Milestone:
Component:  General                  |     Version:  4.7
 Severity:  normal                   |  Resolution:  invalid
 Keywords:  php81 reporter-feedback  |     Focuses:
-------------------------------------+----------------------

Comment (by jrf):

 Replying to [comment:8 mcaskill]:
 > Thank you for the confirmation on the matter.
 >
 > I'll be sure to take this up with the offending third-parties.
 >
 > In which case, should integers be enforced with an `is_int()` check that
 either returns false or calls `_doing_it_wrong()`?


 I'm undecided on that at this moment. Adding a `_doing_it_wrong()` would
 ''raise'' the error level from `E_DEPRECATED` to `E_NOTICE`, but would
 also make it more visible as the notice will display on all PHP versions,
 not just on PHP 8.1 and up.

 I'd like to hear some more opinions about this.

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


More information about the wp-trac mailing list