X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FIP.php;h=37e007665190e02aeeb2a1b9b9fb87d4e94a9e2e;hb=e83ca504052654a2b9decdf6208fec335aa43e7a;hp=06589d278791690f45426ed016ffbab232166cbf;hpb=d8a144d38e8929a49d7e5d49faf87936cacdffc6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/IP.php b/includes/libs/IP.php index 06589d2787..37e0076651 100644 --- a/includes/libs/IP.php +++ b/includes/libs/IP.php @@ -125,6 +125,7 @@ class IP { * @return bool True if it is valid */ public static function isValidBlock( $ipRange ) { + wfDeprecated( __METHOD__, '1.30' ); return self::isValidRange( $ipRange ); } @@ -425,7 +426,7 @@ class IP { $ip = self::sanitizeIP( $ip ); $n = ip2long( $ip ); if ( $n < 0 ) { - $n += pow( 2, 32 ); + $n += 2 ** 32; # On 32-bit platforms (and on Windows), 2^32 does not fit into an int, # so $n becomes a float. We convert it to string instead. if ( is_float( $n ) ) { @@ -467,7 +468,7 @@ class IP { * to an integer network and a number of bits * * @param string $range IP with CIDR prefix - * @return array(int or string, int) + * @return array [int or string, int] */ public static function parseCIDR( $range ) { if ( self::isIPv6( $range ) ) { @@ -487,7 +488,7 @@ class IP { } # Convert to unsigned if ( $network < 0 ) { - $network += pow( 2, 32 ); + $network += 2 ** 32; } } else { $network = false; @@ -523,7 +524,7 @@ class IP { $start = $end = false; } else { $start = sprintf( '%08X', $network ); - $end = sprintf( '%08X', $network + pow( 2, ( 32 - $bits ) ) - 1 ); + $end = sprintf( '%08X', $network + 2 ** ( 32 - $bits ) - 1 ); } // Explicit range } elseif ( strpos( $range, '-' ) !== false ) { @@ -557,7 +558,7 @@ class IP { * * @param string $range * - * @return array(string, int) + * @return array [string, int] */ private static function parseCIDR6( $range ) { # Explode into @@ -598,7 +599,7 @@ class IP { * * @param string $range * - * @return array(string, string) + * @return array [string, string] */ private static function parseRange6( $range ) { # Expand any IPv6 IP