diff --git wp-includes/user.php wp-includes/user.php
index cd4b01d..8eea83d 100644
--- wp-includes/user.php
+++ wp-includes/user.php
@@ -1543,13 +1543,18 @@ function wp_insert_user($userdata) {
  * @return int The updated user's ID.
  */
 function wp_update_user($userdata) {
-	$ID = (int) $userdata['ID'];
-
-	// First, get all of the original fields
-	$user = get_userdata($ID);
-
-	// Escape data pulled from DB.
-	$user = add_magic_quotes(get_object_vars($user));
+	if ( empty( $userdata['ID'] ) ) {
+		$user = array();
+	} else {
+		$user = get_userdata((int) $userdata['ID']);
+		
+		if ( ! $user )
+			return new WP_Error( 'invalid_user_id', sprintf( __( 'Invalid User ID: %s' ), $userdata['ID'] ) );
+		
+		// Escape data pulled from DB.
+		$user = add_magic_quotes(get_object_vars($user));
+		wp_cache_delete($user[ 'user_email' ], 'useremail');
+	}
 
 	// If password is changing, hash it now.
 	if ( ! empty($userdata['user_pass']) ) {
@@ -1557,18 +1562,16 @@ function wp_update_user($userdata) {
 		$userdata['user_pass'] = wp_hash_password($userdata['user_pass']);
 	}
 
-	wp_cache_delete($user[ 'user_email' ], 'useremail');
-
 	// Merge old and new fields with new fields overwriting old ones.
 	$userdata = array_merge($user, $userdata);
 	$user_id = wp_insert_user($userdata);
 
 	// Update the cookies if the password changed.
 	$current_user = wp_get_current_user();
-	if ( $current_user->id == $ID ) {
+	if ( $current_user->id == $user_id ) {
 		if ( isset($plaintext_pass) ) {
 			wp_clear_auth_cookie();
-			wp_set_auth_cookie($ID);
+			wp_set_auth_cookie($user_id);
 		}
 	}
 
