[wp-trac] [WordPress Trac] #57635: Check if empty user_nicename in the function wp_insert_user

WordPress Trac noreply at wordpress.org
Wed Feb 8 19:35:32 UTC 2023


#57635: Check if empty user_nicename in the function wp_insert_user
-------------------------------------------------+-------------------------
 Reporter:  missveronicatv                       |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Users                                |     Version:  6.1.1
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch good-first-bug needs-    |     Focuses:
  testing-info 2nd-opinion                       |
-------------------------------------------------+-------------------------
Changes (by kalpeshh):

 * keywords:  needs-patch good-first-bug needs-testing-info => needs-patch
     good-first-bug needs-testing-info 2nd-opinion


Comment:

 @missveronicatv I tried that and still no luck. I got an expected error `
 "Cannot create a user with an empty login name."`

 Also, if you look at the code, empty `user_login` case is handled. Can you
 please share sample code or API call to reproduce this?


 {{{
         // user_login must be between 0 and 60 characters.
         if ( empty( $user_login ) ) {
                 return new WP_Error( 'empty_user_login', __( 'Cannot
 create a user with an empty login name.' ) );
         } elseif ( mb_strlen( $user_login ) > 60 ) {
                 return new WP_Error( 'user_login_too_long', __( 'Username
 may not be longer than 60 characters.' ) );
         }
 }}}

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


More information about the wp-trac mailing list