From: pk910 Date: Thu, 13 Jun 2013 04:09:02 +0000 (+0200) Subject: small fixes X-Git-Url: http://git.pk910.de/?p=CodeSnippets.git;a=commitdiff_plain;h=447ecdf28c5ed152b2be3df6fee026c28852c95a small fixes --- diff --git a/PHP/IPAddr.class.php b/PHP/IPAddr.class.php index 13018e6..b7894bf 100644 --- a/PHP/IPAddr.class.php +++ b/PHP/IPAddr.class.php @@ -23,6 +23,9 @@ class IPAddr { private $addr_is_ipv6 = false; public function __construct($parse_ip) { + for($i = 0; $i < 8; $i++) + $this->ip6[$i] = 0; + if($parse_ip == null) { //nothing } elseif(preg_match(self::$pattern_IPv6, $parse_ip)) { @@ -150,7 +153,7 @@ class IPAddr { } if(!$ip) return false; - if(!($this->addr_is_ipv6 xor $ip->addr_is_ipv6)) + if($this->addr_is_ipv6 xor $ip->addr_is_ipv6) return false; $i = ($this->addr_is_ipv6 ? 0 : 6); for(;$i < 8; $i++) {