[wp-trac] [WordPress Trac] #64480: WordPress PHP Deprecated: Implicit conversion from float 44.168

WordPress Trac noreply at wordpress.org
Fri Jan 9 18:38:15 UTC 2026


#64480: WordPress PHP Deprecated: Implicit conversion from float 44.168
-------------------------------+------------------------------
 Reporter:  sotnas             |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Media              |     Version:  6.9
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by sabernhardt):

 > Casting the value explicitly beforehand should resolve the warning

 The `wp_image_matches_ratio()` function in [https://github.com/WordPress
 /wordpress-develop/blob/6.9/src/wp-includes/media.php#L1488 line 1488]
 expects all four parameters to be integers.

 If `$image['width']` is not an integer, I would suggest using either
 1. `continue` to try another image size in the loop or
 2. `return false` (`wp_calculate_image_srcset()` returns "False on error
 or when only one source exists").

 In this function, I think I prefer returning `false` when encountering
 unexpected input instead of adding `continue`, casting, or
 `_doing_it_wrong()`. Then the image simply would not get a `srcset`
 attribute. Float values might create problems elsewhere too, but then the
 other place(s) could be better to give an error message or warning.

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


More information about the wp-trac mailing list