Preinitialize WP_User::$data to an object in the event an empty user object is created. Avoids a "Creating default object from empty value" PHP Warning.

Fixes #28019

Built from https://develop.svn.wordpress.org/trunk@31049


git-svn-id: http://core.svn.wordpress.org/trunk@31030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2015-01-05 01:41:23 +00:00
parent 05f1506d93
commit c975c8eeb0
2 changed files with 9 additions and 5 deletions

View File

@ -422,7 +422,7 @@ class WP_User {
*
* @since 2.0.0
* @access private
* @var array
* @var object
*/
var $data;
@ -521,13 +521,17 @@ class WP_User {
$id = 0;
}
if ( $id )
if ( $id ) {
$data = self::get_data_by( 'id', $id );
else
} else {
$data = self::get_data_by( 'login', $name );
}
if ( $data )
if ( $data ) {
$this->init( $data, $blog_id );
} else {
$this->data = new stdClass;
}
}
/**

View File

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