Changing user's email address duplicates email address in DB #5324

Open
opened 2026-02-20 16:59:38 -05:00 by deekerman · 3 comments
Owner

Originally created by @azzy9 on GitHub (May 20, 2025).

Issue

Brought to my attention by user @SinergiaCRM.

Due to me fixing the issue #10433 with PR #10434,
The unintended result is that the user updates the email address in the DB as well as creating and relating the new email address, this results in a duplicate record in the email_addresses table.

Possible Fix

The logic should either be replacing the email address or creating and relating a new email address. Not both.

can stop replacing the old email by removing query at:
SugarEmailAddress.php#L471

Steps to Reproduce the Issue

1. Change email address for user.
2. Look in database in the email_addresses table and see new and old email record both with new email address.

Context

This issue is present in v7 & v8.

Since before the fix, the MySQL query was not functioning so the query never ran.

Version

8.8.0

What browser are you currently using?

Chrome

Browser Version

Chrome

Environment Information

PHP 8.1

Operating System and Version

Ubuntu 24.04

Originally created by @azzy9 on GitHub (May 20, 2025). ### Issue Brought to my attention by user @SinergiaCRM. Due to me fixing the issue #10433 with PR #10434, The unintended result is that the user updates the email address in the DB as well as creating and relating the new email address, this results in a duplicate record in the email_addresses table. ### Possible Fix The logic should either be replacing the email address or creating and relating a new email address. Not both. can stop replacing the old email by removing query at: [SugarEmailAddress.php#L471](https://github.com/salesagility/SuiteCRM/blob/hotfix/include/SugarEmailAddress/SugarEmailAddress.php#L471) ### Steps to Reproduce the Issue ```bash 1. Change email address for user. 2. Look in database in the email_addresses table and see new and old email record both with new email address. ``` ### Context This issue is present in v7 & v8. Since before the fix, the MySQL query was not functioning so the query never ran. ### Version 8.8.0 ### What browser are you currently using? Chrome ### Browser Version Chrome ### Environment Information PHP 8.1 ### Operating System and Version Ubuntu 24.04
Author
Owner

@azzy9 commented on GitHub (May 20, 2025):

I would make a PR with the query at SugarEmailAddress.php#L471 removed.
I know this fixes the issue in SuiteCRM 8.8.0,
but I am unable to test it on v7.14.6 as I do not have a test installation of it.

@azzy9 commented on GitHub (May 20, 2025): I would make a PR with the query at [SugarEmailAddress.php#L471](https://github.com/salesagility/SuiteCRM/blob/hotfix/include/SugarEmailAddress/SugarEmailAddress.php#L471) removed. I know this fixes the issue in SuiteCRM 8.8.0, but I am unable to test it on v7.14.6 as I do not have a test installation of it.
Author
Owner

@SinergiaCRM commented on GitHub (May 20, 2025):

I would make a PR with the query at SugarEmailAddress.php#L471 removed. I know this fixes the issue in SuiteCRM 8.8.0, but I am unable to test it on v7.14.6 as I do not have a test installation of it.

We tested and it works.

@azzy9 , thanks.

@SinergiaCRM commented on GitHub (May 20, 2025): > I would make a PR with the query at [SugarEmailAddress.php#L471](https://github.com/salesagility/SuiteCRM/blob/hotfix/include/SugarEmailAddress/SugarEmailAddress.php#L471) removed. I know this fixes the issue in SuiteCRM 8.8.0, but I am unable to test it on v7.14.6 as I do not have a test installation of it. We tested and it works. @azzy9 , thanks.
Author
Owner

@azzy9 commented on GitHub (May 20, 2025):

Thanks @SinergiaCRM,
I have made a PR

@azzy9 commented on GitHub (May 20, 2025): Thanks @SinergiaCRM, I have made a PR
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5324
No description provided.