[wp-trac] [WordPress Trac] #17775: Possible invalid user roles count with similarly named roles

WordPress Trac wp-trac at lists.automattic.com
Sun Jun 12 18:26:30 UTC 2011


#17775: Possible invalid user roles count with similarly named roles
--------------------------+-------------------------------------
 Reporter:  layotte       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:
 Severity:  minor         |   Keywords:  has-patch needs-testing
--------------------------+-------------------------------------
 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))";
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17775>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list