[wp-trac] [WordPress Trac] #59485: Invalid username

WordPress Trac noreply at wordpress.org
Tue Nov 26 12:20:20 UTC 2024


#59485: Invalid username
----------------------------------------+------------------------------
 Reporter:  rinkalpagdar                |       Owner:  (none)
     Type:  defect (bug)                |      Status:  reopened
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Users                       |     Version:  6.3.1
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch => has-patch needs-unit-tests


Comment:

 Replying to [comment:5 ankitkumarshah]:
 > The `sanitize_user()` function would indeed be a more appropriate choice
 than `sanitize_title()`, as it has been specifically designed for username
 sanitization in WordPress.

 Correct, `sanitize_title()` would replace dots with hyphens in a username,
 which might not be appropriate here, see #17239 / #36286 and #17904.

 It is worth noting, however, that we already run `sanitize_user()` in
 `wp_insert_user()` on [source:tags/6.7.1/src/wp-
 includes/user.php?marks=2156#L2155 line 2156 above], so if that's not
 enough, this might need a closer look. A unit test would be helpful to
 demonstrate the issue.

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


More information about the wp-trac mailing list