In wp_update_user(), make sure $userdata['ID'] is set before using it.

props tyxla.
fixes #31097.
Built from https://develop.svn.wordpress.org/trunk@31269


git-svn-id: http://core.svn.wordpress.org/trunk@31250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-01-22 14:46:23 +00:00
parent 3982471a5c
commit a47a5a1779
2 changed files with 7 additions and 3 deletions

View File

@ -1975,12 +1975,16 @@ function wp_update_user($userdata) {
$userdata = $userdata->to_array();
}
$ID = (int) $userdata['ID'];
$ID = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0;
if ( ! $ID ) {
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
}
// First, get all of the original fields
$user_obj = get_userdata( $ID );
if ( ! $user_obj )
if ( ! $user_obj ) {
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
}
$user = $user_obj->to_array();

View File

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