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.

Built from https://develop.svn.wordpress.org/trunk@35116


git-svn-id: http://core.svn.wordpress.org/trunk@35081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-10-13 02:48:24 +00:00
parent c332da3e12
commit fc842e33c9
2 changed files with 2 additions and 2 deletions

View File

@ -1602,7 +1602,7 @@ function wp_update_user($userdata) {
// Escape data pulled from DB. // Escape data pulled from DB.
$user = add_magic_quotes( $user ); $user = add_magic_quotes( $user );
if ( ! empty($userdata['user_pass']) ) { if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
// If password is changing, hash it now // If password is changing, hash it now
$plaintext_pass = $userdata['user_pass']; $plaintext_pass = $userdata['user_pass'];
$userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] ); $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-35115'; $wp_version = '4.4-alpha-35116';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.