Captcha icon indicating copy to clipboard operation
Captcha copied to clipboard

PHP Deprecated: Implicit conversion from float -- to int loses precision in CaptchaBuilder.php on line 365

Open sscotti opened this issue 2 years ago • 4 comments

Not sure this is still being maintained, but after I upgraded my PHP version to 8.1 I am seeing this error message.

PHP Deprecated: Implicit conversion from float 42.5 to int loses precision in CaptchaBuilder.php on line 365 PHP Deprecated: Implicit conversion from float 3.3333333333333335 to int loses precision in CaptchaBuilder.php on line 608

Seems to be related to:

https://php.watch/versions/8.1/deprecate-implicit-conversion-incompatible-float-string

sscotti avatar Jan 22 '22 19:01 sscotti

See #98

kenjis avatar Jan 27 '22 04:01 kenjis

IMHO better fix #101

polakjakub avatar Feb 01 '22 15:02 polakjakub

I actually had to make changes in 2 places:

CaptchaBuilder.php

365: \imagettftext($image, $size, $angle, round($x), round($y)+ $offset, $col, $font, $symbol);

608: $value = mt_rand(round($min), round($max));

casting as an int would probably work also. Is there going to be an update or should I create my own fork ?

sscotti avatar Feb 09 '22 23:02 sscotti

@sscotti This has been fixed in the latest release 1.2.1

kevinpapst avatar Oct 12 '23 12:10 kevinpapst