[wp-trac] [WordPress Trac] #27205: Unit tests: super admin privledges leak to other tests

WordPress Trac noreply at wordpress.org
Tue Feb 25 21:04:36 UTC 2014


#27205: Unit tests: super admin privledges leak to other tests
------------------------------+--------------------
 Reporter:  jdgrimes          |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.9
Component:  Build/Test Tools  |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:
------------------------------+--------------------

Comment (by jdgrimes):

 Replying to [comment:6 nacin]:
 > Well this is embarrassing. grant_super_admin() only works once per
 pageload. It checks the $super_admins global and bails if it is set, then
 proceeds to set it. [attachment:27205.3.diff] is a unit test that fails.
 >
 > get_super_admins() consults $super_admins directly, but as this function
 is called fairly often, I wonder if this was accidentally done for speed
 purposes.

 `revoke_super_admin()` is also contributing to this problem.
 [attachment:27205.5.diff] addresses this by checking
 `$GLOBALS['super_admins']` istead of bringing the `$super_admins` into the
 functions' scopes. (Ignore [attachment:27205.4.diff])

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27205#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list