Skip to content

Commit 38d4e07

Browse files
authored
phpversion() replacements and code branch collapsing for older PHP versions
Closes GH-600.
1 parent c3f9653 commit 38d4e07

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

include/ip-to-country.inc

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,9 @@ function i2c_realip()
209209
// Skip RFC 1918 IP's 10.0.0.0/8, 172.16.0.0/12 and
210210
// 192.168.0.0/16
211211
// Also skip RFC 6598 IP's
212-
if (!preg_match('/^(?:10|100\.(?:6[4-9]|[7-9]\d|1[01]\d|12[0-7])|172\.(?:1[6-9]|2\d|3[01])|192\.168)\./', $ips[$i])) {
213-
if (version_compare(phpversion(), "5.0.0", ">=")) {
214-
if (ip2long($ips[$i]) != false) {
215-
$ip = $ips[$i];
216-
break;
217-
}
218-
} else {
219-
if (ip2long($ips[$i]) != -1) {
220-
$ip = $ips[$i];
221-
break;
222-
}
223-
}
212+
if (!preg_match('/^(?:10|100\.(?:6[4-9]|[7-9]\d|1[01]\d|12[0-7])|172\.(?:1[6-9]|2\d|3[01])|192\.168)\./', $ips[$i]) && ip2long($ips[$i])) {
213+
$ip = $ips[$i];
214+
break;
224215
}
225216
}
226217
}

mirror-info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function_exists('hash_file') &&
3333

3434
echo implode('|', array(
3535
$MYSITE, // 0 : CNAME for mirror as accessed (CC, CC1, etc.)
36-
phpversion(), // 1 : PHP version overview
36+
PHP_VERSION, // 1 : PHP version overview
3737
$LAST_UPDATED, // 2 : Update problems
3838
$sqlite, // 3 : SQLite support?
3939
$mirror_stats, // 4 : Optional local stats support

0 commit comments

Comments
 (0)