if ( self::isIPv6( $ip ) ) {
$n = self::toUnsigned6( $ip );
} else {
+ // Bug 60035: an IP with leading 0's fails in ip2long sometimes (e.g. *.08)
+ $ip = preg_replace( '/(?<=\.)0+(?=[1-9])/', '', $ip );
$n = ip2long( $ip );
if ( $n < 0 ) {
$n += pow( 2, 32 );
array( 16909060, '1.2.3.4' ),
array( 2130706433, '127.0.0.1' ),
array( '2147483648', '128.0.0.0' ),
+ array( 2130706440, '127.0.0.08' ),
+ array( 2130706441, '127.0.0.09' ),
array( '3735931646', '222.173.202.254' ),
array( pow( 2, 32 ) - 1, '255.255.255.255' ),
array( false, 'IN.VA.LI.D' ),