Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#33820 closed defect (bug) (duplicate)

Fail to create a user whose username is longer than 50

Reported by: hykw's profile hykw Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Users Keywords:
Focuses: Cc:

Description

When you create a user, the length of username is 50 or more, it fails to create the user. And also the result message is as same as the correctly does.

It could easily reproduce the issue like this in admin:

Users > Add New

  Username: 000000000000000000000000000000000000000000000000001
  E-mail: foo@example.com

press [Add New User]

or with wp_insert_user():

$login = '000000000000000000000000000000000000000000000000001';

$wp_insert_data = array(
  'user_login' => $login,
  'user_email' => 'foo@example.com',
  'user_pass' => NULL,
);

$user_id = wp_insert_user($wp_insert_data);

# ----> The value of $user_id is 0
# It should be WP_Error or userid(which is 1 or more), but not.

Some logic in Wordpress expects WP_Error in case of error, it also occurred Notice error in wp_new_user_notification(), due to $user->user_login is wrong.

Attachments (1)

33820.diff (4.0 KB) - added by dipesh.kakadiya 8 years ago.
Patch related #33820 and #33793

Download all attachments as: .zip

Change History (5)

#1 @dipesh.kakadiya
8 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #33793.

#2 @netweb
8 years ago

  • Milestone Awaiting Review deleted

#3 @hykw
8 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

It's not the duplicate. The patches attached in #33793 fixes only in wp-admin/, not wp_insert_user()'s return value. It still return 0, in case of the length is more than expect(60 in the patched version?)

@dipesh.kakadiya
8 years ago

Patch related #33820 and #33793

#4 @dipesh.kakadiya
8 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

@hykw

Added patch ( 33793_1.diff ) for this on ticket #33793

Same patch I added here

Note: See TracTickets for help on using tickets.