}
if ( self::isIPv4( $ip ) ) {
// Remove leading 0's from octet representation of IPv4 address
- $ip = preg_replace( '/(?:^|(?<=\.))0+(?=[1-9]|0\.|0$)/', '', $ip );
+ $ip = preg_replace( '!(?:^|(?<=\.))0+(?=[1-9]|0[./]|0$)!', '', $ip );
return $ip;
}
// Remove any whitespaces, convert to upper case
[ '0.0.0.0', '0.0.0.0' ],
[ '0.0.0.0', '00.00.00.00' ],
[ '0.0.0.0', '000.000.000.000' ],
+ [ '0.0.0.0/24', '000.000.000.000/24' ],
[ '141.0.11.253', '141.000.011.253' ],
[ '1.2.4.5', '1.2.4.5' ],
[ '1.2.4.5', '01.02.04.05' ],