WordPress.org

Make WordPress Core

Changeset 31049


Ignore:
Timestamp:
01/05/2015 01:40:43 AM (7 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/capabilities.php

    r31013 r31049  
    423423     * @since 2.0.0
    424424     * @access private
    425      * @var array
     425     * @var object
    426426     */
    427427    var $data;
     
    522522        }
    523523
    524         if ( $id )
     524        if ( $id ) {
    525525            $data = self::get_data_by( 'id', $id );
    526         else
     526        } else {
    527527            $data = self::get_data_by( 'login', $name );
    528 
    529         if ( $data )
     528        }
     529
     530        if ( $data ) {
    530531            $this->init( $data, $blog_id );
     532        } else {
     533            $this->data = new stdClass;
     534        }
    531535    }
    532536
Note: See TracChangeset for help on using the changeset viewer.