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>
This commit is contained in:
Copilot 2026-01-31 21:45:28 +01:00 committed by GitHub
parent 85d3dd05dc
commit 734a35f89c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);