WordPress.org

Make WordPress Core

Opened 3 weeks ago

Closed 3 weeks ago

#53627 closed defect (bug) (fixed)

Return earlier from wp_update_user() in case of error

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version: 4.3
Component: Users Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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.

Attachments (1)

53627.diff (11.0 KB) - added by SergeyBiryukov 3 weeks ago.

Download all attachments as: .zip

Change History (5)

@SergeyBiryukov
3 weeks ago

#1 @SergeyBiryukov
3 weeks ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#2 @SergeyBiryukov
3 weeks ago

  • Keywords has-patch added

#3 @SergeyBiryukov
3 weeks ago

  • Description modified (diff)

#4 @SergeyBiryukov
3 weeks ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 51398:

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.

Note: See TracTickets for help on using tickets.