Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#53109 reviewing defect (bug)

wp_insert_user should return a WP_Error when passing a too long first_name parameter

Reported by: superpuperlesha's profile superpuperlesha Owned by: audrasjb's profile audrasjb
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Users Keywords: needs-patch
Focuses: Cc:

Description

When I call the wp_insert_user function to which I pass too long first_name, I do not get an error, but I get a 0-integer. Although the documentation says, either wp_error or integer-ok.
P.S. I create user with this function ..

Change History (4)

#1 @audrasjb
2 years ago

  • Focuses coding-standards removed
  • Owner set to audrasjb
  • Status changed from new to reviewing
  • Summary changed from wp_insert_user return 0 to wp_insert_user should return a WP_Error when passing a too long first_name parameter
  • Version 5.7 deleted

Hi, welcome to WordPress Trac @superpuperlesha and thank you for the ticket,

Looking at a glance, wp_insert_user should return WP_Error or create the user without this parameter. Self-assigning the ticket for further investigation.

#2 @SergeyBiryukov
2 years ago

Hi there, welcome to WordPress Trac! Thanks for the report.

Looks like this was previously mentioned in comment:3:ticket:14290 but never addressed.

A similar issue was resolved in WordPress 4.4 for user_login and user_nicename fields: [34218] / #33793, #33820. Looks like we need the same for first_name and last_name.

Last edited 2 years ago by SergeyBiryukov (previous) (diff)

#3 follow-up: @audrasjb
2 years ago

I found something interesting: it looks like the limit is at 250 character. Also, I'm not sure it's really related to the first_name or last_name metadata.
I believe it's more related to the fact that display_name is based on first_name/last_name metadata.

For the moment, I wasn't able to find where this 250 char limit is set. @SergeyBiryukov do you have any clue?

#4 in reply to: ↑ 3 @SergeyBiryukov
2 years ago

Replying to audrasjb:

I believe it's more related to the fact that display_name is based on first_name/last_name metadata.

Ah, good point.

For the moment, I wasn't able to find where this 250 char limit is set. @SergeyBiryukov do you have any clue?

I think it's in the database schema: display_name varchar(250) NOT NULL default ''.

Note: See TracTickets for help on using tickets.