From c59a14f2cff1498bf450bcc33e090079d03c575b Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 12 Mar 2007 07:44:19 +0000 Subject: [PATCH] *Use strval() to ensure wfBaseConvert() recieves a string --- includes/IP.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.20.1