Users: Return earlier from wp_update_user() in case of error.

This ensures that if the `wp_insert_user()` call resulted in a `WP_Error` object, it is returned right away without any further actions.

Follow-up to [32820].

Fixes #53627.
Built from https://develop.svn.wordpress.org/trunk@51398


git-svn-id: http://core.svn.wordpress.org/trunk@51009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-07-10 12:00:58 +00:00
parent d4ca0e0790
commit 514f23aef8
2 changed files with 97 additions and 96 deletions

View File

@ -2238,7 +2238,9 @@ function wp_update_user( $userdata ) {
$userdata = array_merge( $user, $userdata );
$user_id = wp_insert_user( $userdata );
if ( ! is_wp_error( $user_id ) ) {
if ( is_wp_error( $user_id ) ) {
return $user_id;
}
$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
@ -2368,7 +2370,6 @@ All at ###SITENAME###
if ( $switched_locale ) {
restore_previous_locale();
}
}
// Update the cookies if the password changed.
$current_user = wp_get_current_user();

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51397';
$wp_version = '5.9-alpha-51398';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.