From 40c948c1a628ec9b02c5c3eb1ba4eda5ce458339 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 15 Jan 2016 10:46:38 +0000 Subject: [PATCH] Users: Always return `$current_user` in `wp_get_current_user()`, never a boolean. Fixes unit tests affected by [36311]. See #19615. git-svn-id: https://develop.svn.wordpress.org/trunk@36313 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pluggable.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index 50f626dfcc..d5d03546ee 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -62,7 +62,7 @@ if ( !function_exists('wp_get_current_user') ) : * * @global WP_User $current_user Checks if the current user is set. * - * @return bool|WP_User WP_User instance on success, false on XMLRPC Request and invalid auth cookie. + * @return bool Current WP_User instance. */ function wp_get_current_user() { global $current_user; @@ -83,12 +83,12 @@ function wp_get_current_user() { // $current_user has a junk value. Force to WP_User with ID 0. $current_user = null; wp_set_current_user( 0 ); - return false; + return $current_user; } if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) { wp_set_current_user( 0 ); - return false; + return $current_user; } /** @@ -107,7 +107,7 @@ function wp_get_current_user() { $user_id = apply_filters( 'determine_current_user', false ); if ( ! $user_id ) { wp_set_current_user( 0 ); - return false; + return $current_user; } wp_set_current_user( $user_id );