WordPress.org

Make WordPress Core

Ticket #17009: 17009.patch

File 17009.patch, 744 bytes (added by hakre, 7 years ago)

Test for get_userdata() return value before continuing.

  • wp-includes/user.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    15461546        $ID = (int) $userdata['ID'];
    15471547
    15481548        // First, get all of the original fields
    1549         $user = get_userdata($ID);
     1549        if ( $user = get_userdata($ID) ) {
     1550                // Escape data pulled from DB.
     1551                $user = add_magic_quotes(get_object_vars($user));
     1552        } else {
     1553                $user = array();
     1554        }
    15501555
    1551         // Escape data pulled from DB.
    1552         $user = add_magic_quotes(get_object_vars($user));
    1553 
    15541556        // If password is changing, hash it now.
    15551557        if ( ! empty($userdata['user_pass']) ) {
    15561558                $plaintext_pass = $userdata['user_pass'];