[wp-trac] [WordPress Trac] #23016: Allow plugins to manipulate WP_Roles ($wp_roles global) on construct

WordPress Trac noreply at wordpress.org
Wed Nov 2 20:40:12 UTC 2016


#23016: Allow plugins to manipulate WP_Roles ($wp_roles global) on construct
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:  pento
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  4.7
Component:  Role/Capability                      |     Version:  3.5
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  needs-dev-note                                 |
-------------------------------------------------+-------------------------

Comment (by mnelson4):

 @johnjamesjacoby I'm not sure you got my point: `$wp_roles->reinit()`
 shouldn't be replaced by `$wp_roles = new WP_Roles()` like the patches and
 deprecation notice on `WP_Roles::reinit()` indicate.

 See
 * https://core.trac.wordpress.org/attachment/ticket/23016/23016.02.diff,
 line 148 of the new file for the deprecation notice
 * https://core.trac.wordpress.org/attachment/ticket/23016/23016.patch, wp-
 includes/ms-blogs.php line 545 for where `$wp_roles->reinit()` was
 replaced by `$wp_roles = new WP_Roles()`
 * https://core.trac.wordpress.org/attachment/ticket/23016/23016.diff, src
 /wp-includes/ms-blogs.php lines 824, 898,
 tests/phpunit/tests/user/capabilities.php line 35 for more spots where
 `$wp_roles->reinit()` was replaced by `$wp_roles = new WP_Roles()`

 The patch I uploaded adds to your unit test, and I hope shows the problem.
 (Note that unit test fails on master branch, whereas adding that unit test
 to the 4.5.2 tag it passes).

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


More information about the wp-trac mailing list