Page MenuHomePhabricator

searching CU log for usernames with a hyphen gives unspecific results
Closed, ResolvedPublic

Description

Author: wiki.bugzilla

Description:

  1. go to the CU log and use the "target" search
  2. search for usernames like e.g. "John-Doe" or "A-BCD"
  3. it doesn't matter if these specific names actually exist in the log or not, the given result lists _all_ checked accounts that include a hyphen ("-") in their usernames

I regard this as a bug, as it makes the current minimal search functionality less useful, at least on wikis/for languages where hyphens are common and numerous such accounts have been checked.

In addition please note bug 14699 (allow wildcard search):
Of course, a search for only "-" should give such a long output (as it actually does already, don't know why, bug 14699 hasn't been fixed yet), but not a search for a specific username.

Thanks in advance for fixing this issue :-)


Version: unspecified
Severity: normal
URL: http://de.wikipedia.org/wiki/Spezial:Checkuser/Logbuch

Details

Reference
bz15049

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:19 PM
bzimport added a project: CheckUser.
bzimport set Reference to bz15049.

In CheckUser_body.php:

		} else /* target */ {
			$type = 'target';
			// Is it an IP?
			list( $start, $end ) = IP::parseRange( $target );
			if ( $start !== false ) {

This seems to be the problem -- IP::parseRange() is a bit over-aggressive and is giving some weird false positives for non-IP things:

return IP::parseRange("Blah");

array(2) {

[0]=>
bool(false)
[1]=>
bool(false)

}

return IP::parseRange("Foo-Bar");

array(2) {

[0]=>
string(8) "00000000"
[1]=>
string(8) "00000000"

}

So probably IP::parseRange() needs to be tightened up to ensure it returns (false, false) when the components are not IPs...

Created attachment 5129
Proposed patch

How about this?

Attached:

Looks good to me!

return IP::parseRange('Foo-Bar');

array(2) {

[0]=>
bool(false)
[1]=>
bool(false)

}

return IP::parseRange('128.125.1.150-128.125.1.192');

array(2) {

[0]=>
string(8) "807D0196"
[1]=>
string(8) "807D01C0"

}

Applied in r38739 -- thanks for the patch!