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

WordPress Trac noreply at wordpress.org
Sun Feb 5 15:45:15 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:  Awaiting Review
Component:  Users           |    Version:  6.1.1
 Severity:  normal          |   Keywords:  changes-requested
  Focuses:                  |
----------------------------+-------------------------------
 Check if empty 'user_nicename' in the function 'wp_insert_user' after the
 'sanitize_title' and filter 'pre_user_nicename'. Only 'user_nicename'
 length > 50 is being reported as an error.

 With an empty 'user_nicename' in the users WP table the function
 'update_user_caches' will fail with an empty key when calling
 'wp_cache_add'.

 This empty field will give a PHP Warning: "Function WP_Object_Cache::add
 was called <strong>incorrectly</strong>. Cache key must not be an empty
 string. Please see ..."

 Stack trace when the plugin Ultimate Member is calling 'get_users':


 {{{
 wp-includes/functions.php:5835
     WP_Object_Cache->is_valid_key()
     wp-includes/class-wp-object-cache.php:204
     WP_Object_Cache->add()
     wp-includes/cache.php:44
     wp_cache_add()
     wp-includes/user.php:1864
     update_user_caches()
     wp-includes/pluggable.php:141
     cache_users()
     wp-includes/class-wp-user-query.php:856
     WP_User_Query->query()
     wp-includes/class-wp-user-query.php:79
     WP_User_Query->__construct()
     wp-includes/user.php:763
     get_users()
     wp-content/plugins/ultimate-member/includes/core/um-actions-
 form.php:874

     um_submit_form_errors_hook_()
     wp-includes/class-wp-hook.php:308
     do_action('um_submit_form_errors_hook_')
     wp-content/plugins/ultimate-member/includes/core/um-actions-
 form.php:293
     um_submit_form_errors_hook()
     wp-includes/class-wp-hook.php:308
     do_action('um_submit_form_errors_hook')
     wp-content/plugins/ultimate-member/includes/core/class-form.php:569
     um\core\Form->form_init()
     wp-includes/class-wp-hook.php:308
     do_action('template_redirect')
     wp-includes/template-loader.php:13
 }}}

 Stack trace when displaying the backend page WP All Users


 {{{
     wp-includes/functions.php:5835
     WP_Object_Cache->is_valid_key()
     wp-includes/class-wp-object-cache.php:204
     WP_Object_Cache->add()
     wp-includes/cache.php:44
     wp_cache_add()
     wp-includes/user.php:1864
     update_user_caches()
     wp-includes/pluggable.php:141
     cache_users()
     wp-includes/class-wp-user-query.php:856
     WP_User_Query->query()
     wp-includes/class-wp-user-query.php:79
     WP_User_Query->__construct()
     wp-admin/includes/class-wp-users-list-table.php:140
     WP_Users_List_Table->prepare_items()
     wp-admin/users.php:521
 }}}

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


More information about the wp-trac mailing list