small fixes
authorpk910 <philipp@zoelle1.de>
Thu, 13 Jun 2013 04:09:02 +0000 (06:09 +0200)
committerpk910 <philipp@zoelle1.de>
Thu, 13 Jun 2013 04:09:02 +0000 (06:09 +0200)
PHP/IPAddr.class.php

index 13018e686ce59c9dd5b02953ff4c48bfc91b2f58..b7894bf618be4c9acd14be8952ef6250b641a975 100644 (file)
@@ -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++) {