From: Aaron Schulz Date: Mon, 12 Mar 2007 07:44:19 +0000 (+0000) Subject: *Use strval() to ensure wfBaseConvert() recieves a string X-Git-Tag: 1.31.0-rc.0~53797 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=c59a14f2cff1498bf450bcc33e090079d03c575b;p=lhc%2Fweb%2Fwiklou.git *Use strval() to ensure wfBaseConvert() recieves a string --- diff --git a/includes/IP.php b/includes/IP.php index ba6168339e..b0a1d187e6 100644 --- a/includes/IP.php +++ b/includes/IP.php @@ -64,9 +64,9 @@ class IP { if ( count( $parts ) != 2 ) { return false; } - $network = self::toUnsigned( $parts[0] ); - $bits = $parts[1] + 96; + $network = self::toUnsigned( $parts[0] ); if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) { + $bits = $parts[1] + 96; return self::toOctet( $network ) . "/$bits"; } else { return false; @@ -108,10 +108,11 @@ class IP { /** * Given an unsigned integer, returns an IPv6 address in octet notation - * @param $ip integer ipv6 IP address. + * @param $ip integer IP address. * @return string */ public function toOctet( $ip_int ) { + $ip_int = strval($ip_int); // Convert integer to binary $ip_int = wfBaseConvert($ip_int, 10, 2, 128); // Seperate into 8 octets