Users: Always return `$current_user` in `wp_get_current_user()`, never a boolean.

Fixes unit tests affected by [36311].

See #19615.
Built from https://develop.svn.wordpress.org/trunk@36313


git-svn-id: http://core.svn.wordpress.org/trunk@36280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2016-01-15 10:47:25 +00:00
parent 9ea68bc533
commit 9cd880d356
2 changed files with 5 additions and 5 deletions

View File

@ -62,7 +62,7 @@ if ( !function_exists('wp_get_current_user') ) :
* *
* @global WP_User $current_user Checks if the current user is set. * @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() { function wp_get_current_user() {
global $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 has a junk value. Force to WP_User with ID 0.
$current_user = null; $current_user = null;
wp_set_current_user( 0 ); wp_set_current_user( 0 );
return false; return $current_user;
} }
if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) { if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
wp_set_current_user( 0 ); 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 ); $user_id = apply_filters( 'determine_current_user', false );
if ( ! $user_id ) { if ( ! $user_id ) {
wp_set_current_user( 0 ); wp_set_current_user( 0 );
return false; return $current_user;
} }
wp_set_current_user( $user_id ); wp_set_current_user( $user_id );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-alpha-36312'; $wp_version = '4.5-alpha-36313';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.