summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorChristian Schneider2019-09-02 17:14:43 +0200
committerChristian Schneider2019-09-02 17:14:43 +0200
commit2b13737e9299317c865f72f4a276ea0b733c4f5f (patch)
treeb800cc0e889d976ba0957e168df45622aee24ee2 /it.class
parentb422951038a66713c18ec4d24ce71a13dd0756a6 (diff)
downloaditools-2b13737e9299317c865f72f4a276ea0b733c4f5f.tar.gz
itools-2b13737e9299317c865f72f4a276ea0b733c4f5f.tar.bz2
itools-2b13737e9299317c865f72f4a276ea0b733c4f5f.zip
Make itools a bit stricter, new PHP versions start to enforce more declarations
Diffstat (limited to 'it.class')
-rw-r--r--it.class4
1 files changed, 2 insertions, 2 deletions
diff --git a/it.class b/it.class
index 87a8b07..976afe9 100644
--- a/it.class
+++ b/it.class
@@ -372,7 +372,7 @@ static function toascii($text)
* @param $cidrs IP range in CIDR notation (192.168.42.64/26) or array of ranges
* @return true if $ip is within $cidr
*/
-function cidr_match($ip, $cidrs)
+static function cidr_match($ip, $cidrs)
{
foreach ((array)$cidrs as $cidr)
{
@@ -381,7 +381,7 @@ function cidr_match($ip, $cidrs)
$subnet_bin = inet_pton($subnet);
$valid_bytes = $mask ? $mask >> 3 : 42;
$bitmask = 256 - (1 << (8 - ($mask & 7)));
- $lastbyte_matched = $bitmask ? (ord($ip_bin{$valid_bytes}) & $bitmask) == (ord($subnet_bin{$valid_bytes}) & $bitmask) : true;
+ $lastbyte_matched = $bitmask ? (ord($ip_bin[$valid_bytes]) & $bitmask) == (ord($subnet_bin[$valid_bytes]) & $bitmask) : true;
if (substr($ip_bin, 0, $valid_bytes) == substr($subnet_bin, 0, $valid_bytes) && $lastbyte_matched)
return true;