[wp-trac] [WordPress Trac] #52976: user emails comparison should be case insensitive

WordPress Trac noreply at wordpress.org
Mon Apr 6 09:16:10 UTC 2026


#52976: user emails comparison should be case insensitive
-------------------------------------------------+-------------------------
 Reporter:  asaifm                               |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Users                                |     Version:  4.3
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch has-        |     Focuses:
  screenshots reporter-feedback has-unit-tests   |
-------------------------------------------------+-------------------------

Comment (by motylanogha):

 Hi @ozgursar,

 What you observed is the expected, buggy behaviour on the current trunk —
 that's exactly the issue this ticket aims to fix.

 Right now on trunk, the comparison at line 2766 uses strict !==, which
 does see admin at example.com and ADMIN at example.com as different strings.
 However, the way the code flows works, the email gets silently updated
 without properly triggering the confirmation/notification email. So the
 user ends up with a changed email, and no confirmation was ever sent —
 which is a problem.

 The patch in 52976.2.diff fixes this by using strcasecmp() so that case-
 only differences are treated as "same email" — no update, no notification
 needed. This is the correct behaviour since email addresses are case-
 insensitive per RFC 5321, and virtually all mail servers treat them that
 way.

 To verify the fix works, you'd need to apply the patch to your local trunk
 checkout and then confirm that:
 1. Changing admin at example.com -> ADMIN at example.com is treated as no change
 (no notification, no update).
 2. Changing admin at example.com -> different at example.com still properly
 triggers the confirmation email.

 The 2 unit tests included in the patch cover both scenarios.

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


More information about the wp-trac mailing list