Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in email_registration_user_insert() (line 34 of modules/contrib/email_registration/email_registration.module).

Created on 3 July 2023, 12 months ago
Updated 5 December 2023, 7 months ago

Problem/Motivation

When attempting to add a new user without specifying an email address, a warning related to the preg_replace() function occurs.

Steps to reproduce

When an administrator creates a new account without providing a value for the email field, a warning regarding the preg_replace() function is triggered. It is important to note that the email field is not always obligatory, especially for administrators with administer and user permissions. In such cases, users can be added without specifying an email address. Furthermore, if an administrator intends to edit an existing account, there is no requirement to populate the email field. However, it should be mentioned that if the username is automatically generated based on the email address, this situation can lead to such warning.

Proposed resolution

Performing a check to determine if an email value has been provided for the user. If an email value is indeed entered, it proceeds to generate the username based on the email. In the scenario where the username field is left blank, yet an email value is present, it continues to function in its normal manner.

πŸ› Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan suhaib_hija

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

Comments & Activities

Production build 0.69.0 2024