Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#25779 closed defect (bug) (fixed)

wp_notify_moderator() sends multiple emails to the same person if the email addresses are not the same case

Reported by: westi's profile westi Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.8 Priority: normal
Severity: normal Version: 3.1
Component: Mail Keywords: has-patch commit
Focuses: Cc:

Description

In the code we have:

$emails = array( get_option('admin_email') );
if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) )
    $emails[] = $user->user_email;

If the Post Author's email address is something like Foo@bar.com and the admin_email is foo@bar.com then we will send two emails to the same person.

While RFC2821 says:

The local-part of a mailbox MUST BE treated as case sensitive. Therefore, SMTP implementations MUST take care to preserve the case of mailbox local-parts. Mailbox domains are not case sensitive.

WordPress already treats email addresses as case insensitive in other places and places like gmail does too.

Attachments (2)

25779.patch (2.3 KB) - added by SergeyBiryukov 12 years ago.
25779.2.patch (2.3 KB) - added by SergeyBiryukov 12 years ago.
Fixed a typo

Download all attachments as: .zip

Change History (7)

#1 @SergeyBiryukov
12 years ago

  • Milestone changed from Awaiting Review to 3.8
  • Version changed from 3.7.1 to 3.1

Introduced in [16223].

#2 @SergeyBiryukov
12 years ago

25779.patch uses strcasecmp() to compare emails in wp_notify_moderator(), wp_password_change_notification(), and revoke_super_admin(). These are all the instances I could find.

Last edited 12 years ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
12 years ago

  • Component changed from Comments to Mail
  • Keywords has-patch added; needs-patch removed

@SergeyBiryukov
12 years ago

Fixed a typo

#4 @SergeyBiryukov
12 years ago

  • Keywords commit added

#5 @SergeyBiryukov
12 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 26115:

Use case-insensitive comparison for email addresses. fixes #25779.

Note: See TracTickets for help on using tickets.