[wp-trac] [WordPress Trac] #29692: Multisite create new site return fatal error

WordPress Trac noreply at wordpress.org
Thu Sep 18 17:18:00 UTC 2014


#29692: Multisite create new site return fatal error
--------------------------------+----------------------------------------
 Reporter:  kkalvaa             |       Owner:  jeremyfelt
     Type:  defect (bug)        |      Status:  assigned
 Priority:  normal              |   Milestone:  4.0.1
Component:  Networks and Sites  |     Version:  4.0
 Severity:  normal              |  Resolution:
 Keywords:  reporter-feedback   |     Focuses:  administration, multisite
--------------------------------+----------------------------------------

Comment (by nacin):

 Replying to [comment:9 jeremyfelt]:
 > When `install_blog()` is used by core to add a new site, it doesn't
 appear to care whether `$wp_roles` is even available.

 It's initialized in wp-settings.php.

 > If we switch to the public `$wp_roles->reinit()`, we would not be making
 use of the existing `$wp_user_roles` global to set `$wp_roles->roles`. I
 don't know if that causes issues elsewhere. I can't immediately see how it
 could. This happens to be the only place left in core that uses
 `$wp_roles->_init()`. The others (also in `ms-functions.php`) were moved
 in [21485] to `$wp_roles->reinit()` due to their association with
 `switch_to_blog()`.

 $wp_user_roles is a global define, it's designed to override anything from
 the DB. reinit() simply reinitializes the object. However, I now know why
 `_init()` is used — because populate_roles() will stomp all over the role
 definitions and we want to re-init from $wp_user_roles. It'd probably be
 easier to unset( $wp_roles ) and re-construct it, but I'm not inclined to
 touch anything without digging in further.

 > @kkalvaa - Do you have any mu-plugins installed, any role management
 plugins, or any type of multisite "helper" plugin—for domain mapping,
 multiple networks, etc..,.? It would also be helpful to see the full stack
 trace if you're able to reproduce locally.

 I imagine this would cause the problem:

 {{{
 class Grasping_At_Straws extends WP_Roles {
         function __call( $name, $arguments ) {}

         function adding_a_method( $but_why ) {}
 }
 $wp_roles = new Grasping_At_Straws;
 }}}

 Extending WP_Roles isn't entirely out of the question for a role
 management plugin (but why...) but actually defining a custom `__call`
 method would also be required, and only if it doesn't fall back to calling
 $name. In short I don't see this happening, but it's the only explanation
 I can think of it is happening consistently.

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


More information about the wp-trac mailing list