r24561 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24560‎ | r24561 | r24562 >
Date:08:51, 3 August 2007
Author:brion
Status:old
Tags:
Comment:
* 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'.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/IP.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/IP.php
@@ -114,13 +114,14 @@
115115 * @return string
116116 */
117117 public static function sanitizeIP( $ip ) {
118 - if ( !$ip ) return null;
 118+ $ip = trim( $ip );
 119+ if ( $ip === '' ) return null;
119120 // Trim and return IPv4 addresses
120 - if ( self::isIPv4($ip) ) return trim($ip);
 121+ if ( self::isIPv4($ip) ) return $ip;
121122 // Only IPv6 addresses can be expanded
122123 if ( !self::isIPv6($ip) ) return $ip;
123124 // Remove any whitespaces, convert to upper case
124 - $ip = strtoupper( trim($ip) );
 125+ $ip = strtoupper( $ip );
125126 // Expand zero abbreviations
126127 if ( strpos( $ip, '::' ) !== false ) {
127128 $ip = str_replace('::', str_repeat(':0', 8 - substr_count($ip, ':')) . ':', $ip);
Index: trunk/phase3/RELEASE-NOTES
@@ -346,7 +346,9 @@
347347 * Toggles in RTL preferences indented to the right, hidden in IE in some
348348 cases.
349349 * Fix RTL display of the upload form.
 350+* Fixed regression in blocking of username '0'
350351
 352+
351353 == API changes since 1.10 ==
352354
353355 Full API documentation is available at http://www.mediawiki.org/wiki/API

Follow-up revisions

RevisionCommit summaryAuthorDate
r24631Merged revisions 24480-24600 via svnmerge from...david18:39, 6 August 2007

Status & tagging log