Make WordPress Core

Ticket #28435: 28435.3.diff

File 28435.3.diff, 1.2 KB (added by wonderboymusic, 10 years ago)
  • src/wp-includes/user-functions.php

     
    16021602        // Escape data pulled from DB.
    16031603        $user = add_magic_quotes( $user );
    16041604
    1605         if ( ! empty($userdata['user_pass']) ) {
     1605        if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
    16061606                // If password is changing, hash it now
    16071607                $plaintext_pass = $userdata['user_pass'];
    16081608                $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );
  • tests/phpunit/tests/user.php

     
    954954
    955955                wp_new_user_notification( $user, 'this_is_deprecated' );
    956956        }
     957        /**
     958         * @ticket 28435
     959         */
     960        function test_wp_update_user_no_change_pwd() {
     961                $testuserid = 1;
     962                $user = get_userdata( $testuserid );
     963                $pwd_before = $user->user_pass;
     964                wp_update_user( $user );
     965                // Reload the data
     966                $user = get_userdata( $testuserid );
     967                $pwd_after = $user->user_pass;
     968                $this->assertEquals( $pwd_before, $pwd_after );
     969        }
    957970}