Skip to content

Commit 734a35f

Browse files
Copilotsstidl
andauthored
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>
1 parent 85d3dd0 commit 734a35f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/getIP.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ function getIspInfo_ipinfoApi($ip){
134134
]);
135135
}
136136

137-
if (PHP_MAJOR_VERSION >= 8){
137+
if (PHP_VERSION_ID >= 80100){
138138
require_once("geoip2.phar");
139139
}
140140
function getIspInfo_ipinfoOfflineDb($ip){
141-
if (PHP_MAJOR_VERSION < 8 || !file_exists(OFFLINE_IPINFO_DB_FILE) || !is_readable(OFFLINE_IPINFO_DB_FILE)){
141+
if (PHP_VERSION_ID < 80100 || !file_exists(OFFLINE_IPINFO_DB_FILE) || !is_readable(OFFLINE_IPINFO_DB_FILE)){
142142
return null;
143143
}
144144
$reader = new MaxMind\Db\Reader(OFFLINE_IPINFO_DB_FILE);

0 commit comments

Comments
 (0)