[wp-trac] [WordPress Trac] #53627: Return earlier from wp_update_user() in case of error

WordPress Trac noreply at wordpress.org
Thu Jul 8 19:20:18 UTC 2021


#53627: Return earlier from wp_update_user() in case of error
----------------------------+-----------------------------
 Reporter:  SergeyBiryukov  |       Owner:  SergeyBiryukov
     Type:  defect (bug)    |      Status:  accepted
 Priority:  normal          |   Milestone:  5.9
Component:  Users           |     Version:  4.3
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+-----------------------------
Description changed by SergeyBiryukov:

Old description:

> In `wp_update_user()`, there's an `is_wp_error()` check after the
> `wp_insert_user()` call.
>
> However, before an error is returned, some additional code runs to update
> the cookies if the password for the current user has changed.
>
> If the `wp_insert_user()` call resulted in an error, it seems better and
> more predictable to return it right away without any further actions.
>
> Introduced in [32820].

New description:

 In `wp_update_user()`, there's an `is_wp_error()` check after the
 `wp_insert_user()` call.

 However, before an error is returned, some additional code runs to update
 the cookies if the password for the current user has changed.

 If the `wp_insert_user()` call resulted in an error, it seems better and
 more predictable to return it right away without any further actions.

 Introduced in [32820] / #32430.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53627#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list