From a6fe21fe62086fdc4ba1be213344a0c6df7ae4c2 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Wed, 5 Nov 2014 05:11:36 +0000 Subject: [PATCH] Create new $wp_roles object in install_blog() to avoid protected _init() call Our call to `$wp_roles->_init()` relied on the `__call()` method in `WP_Roles` to handle the link to the protected method. This works back to PHP 5.2.9, when a bug was fixed allowing access to protected methods through this exact approach. `install_blog()` needs a fresh `$wp_roles` object after `populate_roles()` resets everything in its path. We can create this new object from scratch, effectively doing the same thing with the call to `_init()` via the constructor. Fixes #29692 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@30242 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/ms-functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index df65938923..b0cd44ce8d 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/wp-includes/ms-functions.php @@ -1352,7 +1352,9 @@ function install_blog( $blog_id, $blog_title = '' ) { make_db_current_silent( 'blog' ); populate_options(); populate_roles(); - $wp_roles->_init(); + + // populate_roles() clears previous role definitions so we start over. + $wp_roles = new WP_Roles(); $url = untrailingslashit( $url );