Fixes for r51236 per CR comments
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 31 May 2009 15:02:43 +0000 (15:02 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 31 May 2009 15:02:43 +0000 (15:02 +0000)
includes/IP.php

index 355c7b6..a2a3547 100644 (file)
@@ -502,10 +502,10 @@ class IP {
      */
     public static function isInRange( $addr, $range ) {
     // Convert to IPv6 if needed
-        $unsignedIP = self::toUnsigned( $addr );
+        $hexIP = self::toHex( $addr );
         list( $start, $end ) = self::parseRange( $range );
-        return (($unsignedIP >= base_convert($start, 16, 10)) &&
-               ($unsignedIP <= base_convert($end, 16, 10)));
+        return (strcmp($hexIP, $start) >= 0 &&
+               strcmp($hexIP, $end) <= 0);
     }
 
     /**