Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sscotti opened this issue Jan 22, 2022 · 4 comments

Comments

@sscotti
Copy link

sscotti commented Jan 22, 2022

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

@kenjis
Copy link

kenjis commented Jan 27, 2022

See #98

@polakjakub
Copy link
Contributor

IMHO better fix #101

@sscotti
Copy link
Author

sscotti commented Feb 9, 2022

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 ?

@kevinpapst
Copy link

@sscotti This has been fixed in the latest release 1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants