From c0b8c6eaf318f9b492de323a5fd6efaa474f67e3 Mon Sep 17 00:00:00 2001 From: Khaled Huthaily Date: Wed, 13 Dec 2023 22:42:03 -0700 Subject: [PATCH] fix generating captcha in PHP 8.1 addresses a PHP 8.1 (and above) deprecation issue that results in losing precision because of `float` instead of `int` when creating a captcha --- system/helpers/captcha_helper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 9f707524abb..e7e760a5f81 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -297,12 +297,12 @@ function create_captcha($data) { $theta += $thetac; $rad = $radius * ($i / $points); - $x = ($rad * cos($theta)) + $x_axis; - $y = ($rad * sin($theta)) + $y_axis; + $x = round(($rad * cos($theta)) + $x_axis); + $y = round(($rad * sin($theta)) + $y_axis); $theta += $thetac; $rad1 = $radius * (($i + 1) / $points); - $x1 = ($rad1 * cos($theta)) + $x_axis; - $y1 = ($rad1 * sin($theta)) + $y_axis; + $x1 = round(($rad1 * cos($theta)) + $x_axis); + $y1 = round(($rad1 * sin($theta)) + $y_axis); imageline($im, $x, $y, $x1, $y1, $colors['grid']); $theta -= $thetac; }