From a31753e54298e17aab3d572b78dae9b447c2046e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 6 Aug 2008 20:54:27 +0000 Subject: [PATCH] * (bug 15049) Fix for CheckUser extension's log search: usernames containing a "-" were incorrectly turned into bogus IP range searches. Patch by Max Semenik. --- RELEASE-NOTES | 4 ++++ includes/IP.php | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 229c067949..9bb680c7ad 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/IP.php b/includes/IP.php index e76f66c1a3..82445a46e6 100644 --- a/includes/IP.php +++ b/includes/IP.php @@ -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 -- 2.20.1