{"id":18947065,"date":"2026-06-24T14:19:58","date_gmt":"2026-06-24T14:19:58","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/php-report-int-cast\/"},"modified":"2026-06-24T14:19:58","modified_gmt":"2026-06-24T14:19:58","slug":"php-report-int-cast","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/php-report-int-cast\/","title":{"rendered":"PHP report : int cast"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 <code>2.6666666666666665<\/code> is being turned into an int without an explicit cast, so PHP warns that precision would be lost.stackoverflow+2What to fix<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Look at <code>\/var\/www\/argonotes.hitop.fr\/wp-content\/plugins\/limit-login-attempts-reloaded\/core\/LimitLoginAttempts.php<\/code> around line 2549 and find the expression producing that float. Then make the conversion explicit with the right intent:<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.php.net\/manual\/en\/migration81.deprecated.php\">php<\/a><\/p>\n\n\n\n<ul>\n<li>Use <code>(int)<\/code> or <code>intval()<\/code> if truncation is correct.<\/li>\n\n\n\n<li>Use <code>round()<\/code> if you want the nearest whole number.<\/li>\n\n\n\n<li>Use <code>floor()<\/code> or <code>ceil()<\/code> if you need always-down or always-up behavior.phpandmysql+1<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example:  <code>$limit = (int) ($value \/ 3);<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Or, if rounding is intended: <code>$limit = (int) round($value \/ 3);<\/code>Why it happens<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PHP 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<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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<\/p>\n","protected":false},"template":"","class_list":["post-18947065","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18947065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18947065\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18947065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}