[wp-trac] [WordPress Trac] #57731: Bug: WP_User_Query returns wrong user details
WordPress Trac
noreply at wordpress.org
Thu Feb 16 11:51:05 UTC 2023
#57731: Bug: WP_User_Query returns wrong user details
---------------------------+------------------------------
Reporter: ak.singla | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 6.1.1
Severity: major | Resolution:
Keywords: needs-testing | Focuses:
---------------------------+------------------------------
Changes (by johnbillion):
* keywords: => needs-testing
* focuses: administration, template, rest-api, performance, coding-
standards =>
* component: Query => Users
Old description:
> Hello,
>
> I am using the below code to fetch the user from the database.
>
> {{{
> $user_query_args = array(
> 'search' => 'abc at email.com',
> 'search_columns' => ['user_email', 'ID']
> );
> $user_query = new WP_User_Query($user_query_args);
> }}}
>
> My Findings:
>
> **If the email does not start with numeric digits**''''
> Case 1:
> - Email: abc at email.com
> - User exists with above email
> - Works fine.
>
> **If the email starts with numeric digits**''''
> Case 2:
> - Email: 123abc at email.com
> - User exists with the above email
> - Work fine.
>
> Case 3: (INVALID RESULTS)
> - Email: 123abc at email.com
> - User DOES NOT exist with the above email
> - **Does not work as intended and returns the user data of the user
> with ID: 123, instead of returning 0 results**
New description:
Hello,
I am using the below code to fetch the user from the database.
{{{
$user_query_args = array(
'search' => 'abc at email.com',
'search_columns' => ['user_email', 'ID']
);
$user_query = new WP_User_Query($user_query_args);
}}}
My Findings:
**If the email does not start with numeric digits**''''
Case 1:
- Email: `abc at email.com`
- User exists with above email
- Works fine.
**If the email starts with numeric digits**''''
Case 2:
- Email: `123abc at email.com`
- User exists with the above email
- Work fine.
Case 3: (INVALID RESULTS)
- Email: `123abc at email.com`
- User DOES NOT exist with the above email
- **Does not work as intended and returns the user data of the user with
ID: 123, instead of returning 0 results**
--
Comment:
Thank you for the report @aksingla
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57731#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list