diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/class-wp-roles.php --- a/wp/wp-includes/class-wp-roles.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/class-wp-roles.php Tue Dec 15 13:49:49 2020 +0100 @@ -95,13 +95,13 @@ * * @since 4.0.0 * - * @param string $name Method to call. - * @param array $arguments Arguments to pass when calling. + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. * @return mixed|false Return value of the callback, false otherwise. */ public function __call( $name, $arguments ) { if ( '_init' === $name ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->_init( ...$arguments ); } return false; } @@ -147,9 +147,10 @@ * * @since 2.0.0 * - * @param string $role Role name. + * @param string $role Role name. * @param string $display_name Role display name. - * @param array $capabilities List of role capabilities in the above format. + * @param bool[] $capabilities List of capabilities keyed by the capability name, + * e.g. array( 'edit_posts' => true, 'delete_posts' => false ). * @return WP_Role|void WP_Role object, if role is added. */ public function add_role( $role, $display_name, $capabilities = array() ) { @@ -199,9 +200,10 @@ * * @since 2.0.0 * - * @param string $role Role name. - * @param string $cap Capability name. - * @param bool $grant Optional, default is true. Whether role is capable of performing capability. + * @param string $role Role name. + * @param string $cap Capability name. + * @param bool $grant Optional. Whether role is capable of performing capability. + * Default true. */ public function add_cap( $role, $cap, $grant = true ) { if ( ! isset( $this->roles[ $role ] ) ) { @@ -220,7 +222,7 @@ * @since 2.0.0 * * @param string $role Role name. - * @param string $cap Capability name. + * @param string $cap Capability name. */ public function remove_cap( $role, $cap ) { if ( ! isset( $this->roles[ $role ] ) ) { @@ -355,7 +357,7 @@ return $wp_user_roles; } - if ( is_multisite() && $this->site_id != get_current_blog_id() ) { + if ( is_multisite() && get_current_blog_id() != $this->site_id ) { remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 ); $roles = get_blog_option( $this->site_id, $this->role_key, array() );