From 66fe5120f7cad434edb1b48ed8b0974c60991dd5 Mon Sep 17 00:00:00 2001 From: Khaled Huthaily Date: Thu, 11 Aug 2022 17:00:03 -0600 Subject: [PATCH] fix creating captcha in PHP 8 imageline() in PHP 8 has been updated: https://www.php.net/manual/en/function.imageline.php. This fix solves the "implicit conversion from float ... to int loses precision" error 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 9fcbd1b2d7..c7feeac341 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -278,12 +278,12 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = { $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; }