Преглед изворни кода

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 <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: sstidl <[email protected]>
Copilot пре 2 месеци
родитељ
комит
734a35f89c
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      backend/getIP.php

+ 2 - 2
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);