Make WordPress Core


Ignore:
Timestamp:
10/13/2015 02:47:09 AM (9 years ago)
Author:
wonderboymusic
Message:

Users: when passing a WP_User instance to wp_update_user(), ensure that the user password is not accidentally double-hashed. This is terrifying.

Adds unit tests.

Props tbcorr, salcode.
Fixes #28435.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r34859 r35116  
    955955        wp_new_user_notification( $user, 'this_is_deprecated' );
    956956    }
     957
     958    /**
     959     * @ticket 28435
     960     */
     961    function test_wp_update_user_no_change_pwd() {
     962        $testuserid = 1;
     963        $user = get_userdata( $testuserid );
     964        $pwd_before = $user->user_pass;
     965        wp_update_user( $user );
     966       
     967        // Reload the data
     968        $pwd_after = get_userdata( $testuserid )->user_pass;
     969        $this->assertEquals( $pwd_before, $pwd_after );
     970    }
    957971}
Note: See TracChangeset for help on using the changeset viewer.