From 26b71cb7b4eeb22f48bc9df56842ec8e6c0b00ca Mon Sep 17 00:00:00 2001 From: sunsgne <51745500+sunsgneayo@users.noreply.github.com> Date: Thu, 29 Dec 2022 11:37:01 +0800 Subject: [PATCH] The fourth parameter of imagettftext() in php8.1 adds float() error:Implicit conversion from float 35.5 to int loses precision --- src/Gregwar/Captcha/CaptchaBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gregwar/Captcha/CaptchaBuilder.php b/src/Gregwar/Captcha/CaptchaBuilder.php index 8dbbd61..2fc5941 100644 --- a/src/Gregwar/Captcha/CaptchaBuilder.php +++ b/src/Gregwar/Captcha/CaptchaBuilder.php @@ -362,7 +362,7 @@ protected function writePhrase($image, $phrase, $font, $width, $height) $w = $box[2] - $box[0]; $angle = $this->rand(-$this->maxAngle, $this->maxAngle); $offset = $this->rand(-$this->maxOffset, $this->maxOffset); - \imagettftext($image, $size, $angle, $x, $y + $offset, $col, $font, $symbol); + \imagettftext($image, $size, $angle, floatval($x), $y + $offset, $col, $font, $symbol); $x += $w; }