[wp-trac] [WordPress Trac] #47902: hook wp_pre_insert_user_data should return a WP_Error when returned empty

WordPress Trac noreply at wordpress.org
Tue Aug 20 16:36:17 UTC 2019


#47902: hook wp_pre_insert_user_data should return a WP_Error when returned empty
-------------------------+-----------------------------
 Reporter:  juliobox     |       Owner:  SergeyBiryukov
     Type:  enhancement  |      Status:  reviewing
 Priority:  normal       |   Milestone:  5.3
Component:  Users        |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-----------------------------
Description changed by SergeyBiryukov:

Old description:

> (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)

New description:

 (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)

--

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


More information about the wp-trac mailing list