salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.26k stars 2.03k forks source link

MySQL error when changing email for user #10433

Open azzy9 opened 1 month ago

azzy9 commented 1 month ago

Issue

While changing an email address for a user within admin I noticed an error within the log. While my environment is suitecrm 8, the issue is within the legacy files.

LOG FILE: [FATAL] Query Failed: UPDATE email_addresses SET email_address = 'x@x.com', email_address_caps = 'X@X.COM' WHERE id = ''bee3d040-8f84-31e0-787d-634e8a7ee022'' AND deleted = 0: MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bee3d040-8f84-31e0-787d-634e8a7ee022'' AND deleted = 0' at line 6

Possible Fix

The issue is: https://github.com/salesagility/SuiteCRM/blob/hotfix/include/SugarEmailAddress/SugarEmailAddress.php#L469 The id is being double quoted.

Steps to Reproduce the Issue

1. go to a user in admin
2. change email
3. check log for error

Context

No response

Version

8.6.0

What browser are you currently using?

Other

Browser Version

No response

Environment Information

PHP 8.1

Operating System and Version

ubuntu 22.04