WordPress.org

Make WordPress Core

Changeset 30255


Ignore:
Timestamp:
11/06/2014 08:08:00 AM (5 years ago)
Author:
nacin
Message:

Create new $wp_roles object in install_blog() to avoid protected _init() call

Merges [30242] to the 4.0 branch.

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.

props jeremyfelt.
fixes #29692.

Location:
branches/4.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/wp-includes/ms-functions.php

    r28835 r30255  
    13801380    populate_options();
    13811381    populate_roles();
    1382     $wp_roles->_init();
     1382
     1383    // populate_roles() clears previous role definitions so we start over.
     1384    $wp_roles = new WP_Roles();
    13831385
    13841386    $url = untrailingslashit( $url );
Note: See TracChangeset for help on using the changeset viewer.