PHP report : int cast
-
PHP Deprecated: Implicit conversion from float 2.6666666666666665 to int loses precision in wp-content/plugins/limit-login-attempts-reloaded/core/LimitLoginAttempts.php on line 2549
This is a PHP 8.1+ deprecation warning caused by an implicit float-to-int conversion, and it usually means the code at that line is using a float where an integer is expected. In your case, the value
2.6666666666666665is being turned into an int without an explicit cast, so PHP warns that precision would be lost.stackoverflow+2What to fixLook at
/var/www/argonotes.hitop.fr/wp-content/plugins/limit-login-attempts-reloaded/core/LimitLoginAttempts.phparound line 2549 and find the expression producing that float. Then make the conversion explicit with the right intent:php- Use
(int)orintval()if truncation is correct. - Use
round()if you want the nearest whole number. - Use
floor()orceil()if you need always-down or always-up behavior.phpandmysql+1
Example:
$limit = (int) ($value / 3);Or, if rounding is intended:
$limit = (int) round($value / 3);Why it happensPHP 8.1 deprecated lossy implicit conversions from float to int, including in operators and array keys, because the result can silently drop the decimal part. This warning is common in plugins and libraries after upgrades, especially when calculations produce non-integer results.github+2Practical next step
In that plugin file, identify the exact variable at line 2549 and decide whether truncation or rounding is the correct business logic. If you paste the surrounding code from a few lines before and after line 2549, I can tell you the safest exact edit
- Use
You must be logged in to reply to this topic.