Status report confuses null email with duplicate email

Created on 21 November 2024, about 1 month ago

Problem/Motivation

The status report now contains a check for duplicate email address and reports them with the heading "Conflicting user emails". However, accounts may be created without an email, i.e. with a NULL email, and these accounts incorrectly trigger the warning. Further, the drupal.org page linked to by the message contains a SQL query that does not return the NULL email messages, confusing the administrator as to which accounts are causing the warning.

Steps to reproduce

Create two different user accounts, both without an email address. View the status report and note the warning about conflicting user emails.

Proposed resolution

Exclude NULL email messages from the query that triggers the warning. In user.install, userRequirements():

  $query = \Drupal::database()->select('users_field_data');
  $query->addExpression('LOWER(mail)', 'lower_mail');
  $query->groupBy('lower_mail');
  $query->having('COUNT(uid) > :matches', [':matches' => 1]);
  $conflicts = $query->countQuery()->execute()->fetchField();

add

  $query->isNotNull('mail');

Remaining tasks

Also update the linked-to page to exclude NULL email addresses in the example query.

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

user.module

Created by

🇺🇸United States DanChadwick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024