Opened 2 years ago
Closed 13 months ago
#17775 closed defect (bug) (fixed)
Possible invalid user roles count with similarly named roles
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Users | Version: | 3.1.3 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | lew@… |
Description
How to replicate: Create a user role named "custom_administrator", add users to this role. Role count in /wp-admin/users.php for the "Administrator" role will include the users in the "custom_administrator" role.
Currently line 852 of /wp-includes/users.php counts the roles with this line:
$select_count[] = "COUNT(NULLIF(`meta_value` LIKE '%" . like_escape($this_role) . "%', FALSE))";
Lines in DB look like this:
a:1:{s:13:"administrator";s:1:"1";}
a:1:{s:20:"custom_administrator";s:1:"1";}
Patch for users.php attached, to this:
$select_count[] = "COUNT(NULLIF(`meta_value` LIKE '%\"" . like_escape($this_role) . "\"%', FALSE))";
Attachments (1)
Change History (3)
comment:1
johnbillion — 2 years ago
comment:2
coffee2code — 13 months ago
- Keywords needs-testing removed
- Milestone changed from Awaiting Review to 3.4
- Resolution set to fixed
- Status changed from new to closed
- Version set to 3.1.3
Fixed in [19735].
Note: See
TracTickets for help on using
tickets.

Related: #12693