Return WP_Error from wp_update_user() on a non-existent user, avoiding a fatal error in the process.

props n7studios, SergeyBiryukov.
fixes #22858 for trunk.
Unit tests: [11776/tests].



git-svn-id: http://core.svn.wordpress.org/trunk@23210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-12-27 15:36:08 +00:00
parent 8d52e9fc68
commit 7c5a0db7c1
1 changed files with 2 additions and 0 deletions

View File

@ -1452,6 +1452,8 @@ function wp_update_user($userdata) {
// First, get all of the original fields
$user_obj = get_userdata( $ID );
if ( ! $user_obj )
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
$user = $user_obj->to_array();