Index: trunk/phase3/includes/IP.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | // An IPv6 block is an IP address and a prefix (d1 to d128) |
35 | 35 | define( 'RE_IPV6_WORD', '([0-9A-Fa-f]{1,4})' ); |
36 | 36 | define( 'RE_IPV6_PREFIX', '(12[0-8]|1[01][0-9]|[1-9]?\d)'); |
37 | | -// An IPv6 address is made up of 8 words. However, the "::" abbreviations can be used. |
| 37 | +// An IPv6 address is made up of 8 words. However, the "::" abbreviation can be used. |
38 | 38 | define( 'RE_IPV6_ADD', |
39 | 39 | '(' . // starts with "::" (includes the address "::") |
40 | 40 | '(::|:(:' . RE_IPV6_WORD . '){1,7})' . |
— | — | @@ -175,12 +175,12 @@ |
176 | 176 | ? $CIDRStart - 1 |
177 | 177 | : strlen( $ip ) - 1; |
178 | 178 | // If the '::' is at the beginning... |
179 | | - if( $abbrevPos == 0 ) { |
| 179 | + if ( $abbrevPos == 0 ) { |
180 | 180 | $repeat = '0:'; |
181 | 181 | $extra = ( $ip == '::' ) ? '0' : ''; // for the address '::' |
182 | 182 | $pad = 9; // 7+2 (due to '::') |
183 | 183 | // If the '::' is at the end... |
184 | | - } elseif( $abbrevPos == ( $addressEnd - 1 ) ) { |
| 184 | + } elseif ( $abbrevPos == ( $addressEnd - 1 ) ) { |
185 | 185 | $repeat = ':0'; |
186 | 186 | $extra = ''; |
187 | 187 | $pad = 9; // 7+2 (due to '::') |
— | — | @@ -277,7 +277,7 @@ |
278 | 278 | |
279 | 279 | // ip2long accepts incomplete addresses, as well as some addresses |
280 | 280 | // followed by garbage characters. Check that it's really valid. |
281 | | - if( $ip != long2ip( $n ) ) { |
| 281 | + if ( $ip != long2ip( $n ) ) { |
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | |
— | — | @@ -376,7 +376,7 @@ |
377 | 377 | */ |
378 | 378 | public static function toUnsigned( $ip ) { |
379 | 379 | if ( self::isIPv6( $ip ) ) { |
380 | | - $n = wfBaseConvert( self::IPv6ToRawHex( $ip ), 16, 10 ); |
| 380 | + $n = self::toUnsigned6( $ip ); |
381 | 381 | } else { |
382 | 382 | $n = ip2long( $ip ); |
383 | 383 | if ( $n < 0 ) { |
— | — | @@ -394,7 +394,7 @@ |
395 | 395 | * Convert a network specification in CIDR notation |
396 | 396 | * to an integer network and a number of bits |
397 | 397 | * @param string $range IP with CIDR prefix |
398 | | - * @return array(int, int) |
| 398 | + * @return array(int or string, int) |
399 | 399 | */ |
400 | 400 | public static function parseCIDR( $range ) { |
401 | 401 | if ( self::isIPv6( $range ) ) { |
— | — | @@ -520,7 +520,7 @@ |
521 | 521 | * 2001:0db8:85a3::7344/96 CIDR |
522 | 522 | * 2001:0db8:85a3::7344 - 2001:0db8:85a3::7344 Explicit range |
523 | 523 | * 2001:0db8:85a3::7344/96 Single IP |
524 | | - * @return array(string, int) |
| 524 | + * @return array(string, string) |
525 | 525 | */ |
526 | 526 | private static function parseRange6( $range ) { |
527 | 527 | # Expand any IPv6 IP |