Index: trunk/phase3/includes/IP.php |
— | — | @@ -64,9 +64,9 @@ |
65 | 65 | if ( count( $parts ) != 2 ) { |
66 | 66 | return false; |
67 | 67 | } |
68 | | - $network = self::toUnsigned( $parts[0] ); |
69 | | - $bits = $parts[1] + 96; |
| 68 | + $network = self::toUnsigned( $parts[0] ); |
70 | 69 | if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) { |
| 70 | + $bits = $parts[1] + 96; |
71 | 71 | return self::toOctet( $network ) . "/$bits"; |
72 | 72 | } else { |
73 | 73 | return false; |
— | — | @@ -108,10 +108,11 @@ |
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Given an unsigned integer, returns an IPv6 address in octet notation |
112 | | - * @param $ip integer ipv6 IP address. |
| 112 | + * @param $ip integer IP address. |
113 | 113 | * @return string |
114 | 114 | */ |
115 | 115 | public function toOctet( $ip_int ) { |
| 116 | + $ip_int = strval($ip_int); |
116 | 117 | // Convert integer to binary |
117 | 118 | $ip_int = wfBaseConvert($ip_int, 10, 2, 128); |
118 | 119 | // Seperate into 8 octets |