From ccef8d2b48ed54927cfdce6c5092b83494744949 Mon Sep 17 00:00:00 2001 From: Aspirant Zhang Date: Tue, 12 Jul 2022 16:15:00 +0800 Subject: [PATCH] fix: float to int deprecation in php8.1 (#3) --- extend/ba/Captcha.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extend/ba/Captcha.php b/extend/ba/Captcha.php index a34f04d4..6fa8a5c4 100644 --- a/extend/ba/Captcha.php +++ b/extend/ba/Captcha.php @@ -280,8 +280,8 @@ class Captcha } else { for ($i = 0; $i < $this->length; $i++) { $code[$i] = $captcha ? $captcha[$i] : $this->codeSet[mt_rand(0, strlen($this->codeSet) - 1)]; - $codeNX += mt_rand($this->fontSize * 1.2, $this->fontSize * 1.6); - imagettftext($this->image, $this->fontSize, mt_rand(-40, 40), $codeNX, $this->fontSize * 1.6, $this->color, $this->fontttf, $code[$i]); + $codeNX += mt_rand((int)($this->fontSize * 1.2), (int)($this->fontSize * 1.6)); + imagettftext($this->image, $this->fontSize, mt_rand(-40, 40), (int)$codeNX, (int)($this->fontSize * 1.6), (int)$this->color, $this->fontttf, $code[$i]); } } return $captcha ? $captcha : $code;