Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#47902 closed enhancement (fixed)

hook wp_pre_insert_user_data should return a WP_Error when returned empty

Reported by: juliobox's profile juliobox Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.3
Component: Users Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

(This is a follow-up to #40545.)

Hello there.

In wp_insert_user() there is a lot of check of valid data or not, but since wp_pre_insert_user_data, the returned value is not checked at all.

I know, you'll say "hey, you have to return something !" well, yes, but I want to shortcut and forbid this, so actually I'm returning __return_empty_array which is doing the job well, BUT is the admin area we still got the message "New user created." like nothing happened.

I think we should add a new control here. (see patch)

Attachments (1)

47902.diff (563 bytes) - added by juliobox 5 years ago.

Download all attachments as: .zip

Change History (6)

5 years ago

#1 @juliobox
5 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#4 @SergeyBiryukov
5 years ago

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

In 45858:

Users: In wp_insert_user(), account for the wp_pre_insert_user_data filter returning empty data.

Props juliobox, SergeyBiryukov.
Fixes #47902.

#5 @SergeyBiryukov
5 years ago

In 45859:

Tests: Remove $wpdb global reference from test_wp_insert_user_with_empty_data().

See #47902.

Note: See TracTickets for help on using tickets.