WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#28004 closed defect (bug) (fixed)

wp_insert_user() updates usermeta table when user ID does not exist

Reported by: bilalcoder Owned by: swissspidy
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

wp_insert_user() doesn't care if the user exists in the database when updating.

Attachments (2)

user.diff (487 bytes) - added by bilalcoder 7 years ago.
28004.diff (1.8 KB) - added by swissspidy 6 years ago.

Download all attachments as: .zip

Change History (8)

@bilalcoder
7 years ago

#1 @SergeyBiryukov
7 years ago

  • Keywords has-patch added

#2 @swissspidy
6 years ago

  • Keywords needs-refresh needs-unit-tests added

Needs a refresh after splitting up the user.php file.

#3 @wonderboymusic
6 years ago

  • Milestone changed from Awaiting Review to 4.4

#4 @SergeyBiryukov
6 years ago

  • Owner set to swissspidy
  • Status changed from new to assigned

@swissspidy
6 years ago

#5 @swissspidy
6 years ago

  • Keywords has-unit-tests added; needs-refresh needs-unit-tests removed

28004.diff is an updated patch against trunk that also includes a user test. I updated the error message to use an already existing string.

#6 @wonderboymusic
5 years ago

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

In 35280:

Users: when calling wp_insert_user() with an valid user ID, return WP_Error instead of arbitrarily updating user meta.

Adds unit test.

Props swissspidy, bilalcoder.
Fixes #28004.

Note: See TracTickets for help on using tickets.