From 63ee24789dcc1dba5ec5152d2121b0e078102ab1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 22 Jan 2015 14:45:14 +0000 Subject: [PATCH] In wp_update_user(), make sure $userdata['ID'] is set before using it. props tyxla. fixes #31097. git-svn-id: https://develop.svn.wordpress.org/trunk@31269 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 00f27a8f29..5f98b1e478 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -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();