Ticket #29880: 29880.diff
File 29880.diff, 1.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/user.php
1687 1687 $update = true; 1688 1688 $old_user_data = WP_User::get_data_by( 'id', $ID ); 1689 1689 // hashed in wp_update_user(), plaintext if called directly 1690 $user_pass = $userdata['user_pass'];1690 $user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass; 1691 1691 } else { 1692 1692 $update = false; 1693 1693 // Hash the password -
tests/phpunit/tests/user.php
669 669 670 670 $this->assertSame( $user->user_nicename, $updated_user->user_nicename ); 671 671 } 672 673 /** 674 * @ticket 29880 675 */ 676 function test_wp_insert_user() { 677 $user_details = array( 678 'user_login' => rand_str(), 679 'user_pass' => 'password', 680 'user_email' => rand_str() . '@example.com', 681 ); 682 $id1 = wp_insert_user( $user_details ); 683 $this->assertEquals( $id1, email_exists( $user_details['user_email'] ) ); 684 685 // Check that providing an empty password doesn't remove a user's password. 686 // See ticket #29880 687 $user_details['ID'] = $id1; 688 $user_details['user_pass'] = ''; 689 $id1 = wp_insert_user( $user_details ); 690 $user = WP_User::get_data_by( 'id', $id1 ); 691 $this->assertNotEmpty( $user->user_pass ); 692 } 693 672 694 }