From a47a5a177973e51dbdd862cbd7622308caabfc2a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 22 Jan 2015 14:46:23 +0000 Subject: [PATCH] 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 --- wp-includes/user.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index 00f27a8f29..5f98b1e478 100644 --- a/wp-includes/user.php +++ b/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(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 47c600cb5c..7085cc0cef 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.