Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#21318 closed enhancement (fixed)

User search does not trim whitespace leading to good results not being returned

Reported by: tollmanz Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch
Focuses: Cc:


When searching for a user in a single site (in a network or single site install), addition of a leading or trailing whitespace can lead to no results being returned. While technically, the string with the whitespace isn't matched, the search string should be trimmed prior to the being used in the search.

To reproduce:
1) Go to wp-admin/users.php
2) Assuming you have a user with name "admin", search for "admin " (note the trailing whitespace)
3) No results will be returned (assuming no user with the "admin " exists)
4) Search for "admin"
5) The "admin" user account will be returned.

The search term should be trimmed before sending to WP_User_Query

Attachments (1)

21318.diff (500 bytes) - added by tollmanz 9 years ago.

Download all attachments as: .zip

Change History (6)

9 years ago

#1 @tollmanz
9 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
9 years ago

  • Milestone changed from Awaiting Review to 3.5

#3 @shawnhooper
9 years ago

Successfully tested against revision 21314.

Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1

#4 @MikeHansenMe
9 years ago

Tested and can confirm it is working in version 3.5-alpha-21751

#5 @nacin
9 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [21864]:

Trim incoming searches on the users list table. props tollmanz. fixes #21318.

Note: See TracTickets for help on using tickets.