* (bug 15049) Fix for CheckUser extension's log search: usernames containing
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Aug 2008 20:54:27 +0000 (20:54 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Aug 2008 20:54:27 +0000 (20:54 +0000)
  a "-" were incorrectly turned into bogus IP range searches.
  Patch by Max Semenik.

RELEASE-NOTES
includes/IP.php

index 229c067..9bb680c 100644 (file)
@@ -63,6 +63,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Special pages are now not subject to special handling for "self-links"
 * (bug 15053) Syntactically incorrect redirects with another link in them
   no longer redirect to the second link 
+* (bug 15049) Fix for CheckUser extension's log search: usernames containing
+  a "-" were incorrectly turned into bogus IP range searches.
+  Patch by Max Semenik.
+
 
 === API changes in 1.14 ===
 
index e76f66c..82445a4 100644 (file)
@@ -426,12 +426,16 @@ class IP {
                } elseif ( strpos( $range, '-' ) !== false ) {
                        # Explicit range
                        list( $start, $end ) = array_map( 'trim', explode( '-', $range, 2 ) );
-                       $start = self::toUnsigned( $start ); $end = self::toUnsigned( $end );
-                       if ( $start > $end ) {
-                               $start = $end = false;
+                       if( self::isIPAddress( $start ) && self::isIPAddress( $end ) ) {
+                               $start = self::toUnsigned( $start ); $end = self::toUnsigned( $end );
+                               if ( $start > $end ) {
+                                       $start = $end = false;
+                               } else {
+                                       $start = sprintf( '%08X', $start );
+                                       $end = sprintf( '%08X', $end );
+                               }
                        } else {
-                               $start = sprintf( '%08X', $start );
-                               $end = sprintf( '%08X', $end );
+                               $start = $end = false;
                        }
                } else {
                        # Single IP