From 734a35f89c8f7b6ed8a415337e32e40432df8200 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 21:45:28 +0100 Subject: [PATCH] Fix PHP version check for geoip2.phar compatibility (#754) * Initial plan * Fix PHP version check to require PHP 8.1.0+ for geoip2.phar Changed from PHP_MAJOR_VERSION >= 8 to PHP_VERSION_ID >= 80100 to match the actual requirement of geoip2.phar which needs PHP 8.1.0 or higher. This prevents HTTP 500 errors on PHP 8.0.x installations. Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> --- backend/getIP.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/getIP.php b/backend/getIP.php index d7bc4fa..371db92 100755 --- a/backend/getIP.php +++ b/backend/getIP.php @@ -134,11 +134,11 @@ function getIspInfo_ipinfoApi($ip){ ]); } -if (PHP_MAJOR_VERSION >= 8){ +if (PHP_VERSION_ID >= 80100){ require_once("geoip2.phar"); } function getIspInfo_ipinfoOfflineDb($ip){ - if (PHP_MAJOR_VERSION < 8 || !file_exists(OFFLINE_IPINFO_DB_FILE) || !is_readable(OFFLINE_IPINFO_DB_FILE)){ + if (PHP_VERSION_ID < 80100 || !file_exists(OFFLINE_IPINFO_DB_FILE) || !is_readable(OFFLINE_IPINFO_DB_FILE)){ return null; } $reader = new MaxMind\Db\Reader(OFFLINE_IPINFO_DB_FILE);