From 977977e314d4ab43c51824661fcc4f380bd0c6bf Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 3 Aug 2007 08:51:55 +0000 Subject: [PATCH] * Fixed regression in blocking of username '0' IP::sanitizeIP() for some reason is used to return IP-or-something-that's-not-an-IP, but was incorrectly checking for empties. Thus for '0' input it returned NULL instead of '0'. --- RELEASE-NOTES | 2 ++ includes/IP.php | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 78548331a4..1e1370806e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -346,6 +346,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Toggles in RTL preferences indented to the right, hidden in IE in some cases. * Fix RTL display of the upload form. +* Fixed regression in blocking of username '0' + == API changes since 1.10 == diff --git a/includes/IP.php b/includes/IP.php index a84fb6d931..4c24ed9b72 100644 --- a/includes/IP.php +++ b/includes/IP.php @@ -114,13 +114,14 @@ class IP { * @return string */ public static function sanitizeIP( $ip ) { - if ( !$ip ) return null; + $ip = trim( $ip ); + if ( $ip === '' ) return null; // Trim and return IPv4 addresses - if ( self::isIPv4($ip) ) return trim($ip); + if ( self::isIPv4($ip) ) return $ip; // Only IPv6 addresses can be expanded if ( !self::isIPv6($ip) ) return $ip; // Remove any whitespaces, convert to upper case - $ip = strtoupper( trim($ip) ); + $ip = strtoupper( $ip ); // Expand zero abbreviations if ( strpos( $ip, '::' ) !== false ) { $ip = str_replace('::', str_repeat(':0', 8 - substr_count($ip, ':')) . ':', $ip); -- 2.20.1