Gregwar / Captcha

PHP Captcha library
MIT License
1.73k stars 290 forks source link

Fix warning in PHP 8.2 #114

Closed fakerybakery closed 1 year ago

fakerybakery commented 1 year ago

On certain systems, when using PHP 8.2, the following warning will appear:

Deprecated: Implicit conversion from float 30.5 to int loses precision in (path)/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php on line 365

When setting the header to Content-type: image/jpeg, the errors will not appear, but the image will be blank. My proposed solution is to use intval to convert the floats to integers, thus solving this issue. Thank you!