WordPress.org

Make WordPress Core

Ticket #16731: user.php.diff

File user.php.diff, 624 bytes (added by adambackstrom, 7 years ago)

Ensure $user is an array

  • wp-includes/user.php

     
    15481548        // First, get all of the original fields
    15491549        $user = get_userdata($ID);
    15501550
    1551         // Escape data pulled from DB.
    1552         $user = add_magic_quotes(get_object_vars($user));
     1551        if( false === $user ) {
     1552                // No userdata was found
     1553                $user = array();
     1554        } else {
     1555                // Escape data pulled from DB.
     1556                $user = add_magic_quotes(get_object_vars($user));
     1557        }
    15531558
    15541559        // If password is changing, hash it now.
    15551560        if ( ! empty($userdata['user_pass']) ) {