Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUGAREMAILADDRESS error, the variable $addr is empty and it creates logs when it should not #577

Open
AlexMyddleware opened this issue Dec 2, 2024 · 0 comments
Labels
Priority:Important Issues & PRs that are important; broken functions; errors; there are workarounds Severity: Moderate Minor Impact Type: Bug Something isn't working

Comments

@AlexMyddleware
Copy link

Issue

here is the relevant log

Thu Nov 28 14:52:10 2024 [1755559][d66ee7cb-4e64-75a0-2af5-5eb900163da3][FATAL] SUGAREMAILADDRESS: address did not valid [ ]

we see that there is nothing between the square brackets, even though the content of the $addr variable should be there.

if we look at the relevant code in the public/legacy/include/SugarEmailAddress/SugarEmailAddress.php file, we see that
it generates an error log with the variable $addr if the regex is not validated

if (preg_match($this->regex, $addr)) { // line 1081
[... rest of the code...]
$GLOBALS['log']->fatal("SUGAREMAILADDRESS: address did not valid [ {$addr} ]"); // line 1119

we should not get a log if $addr is empty, in fact i suspect we should not even step into this function.

Possible Fix

we could add a check for the empty of the variable $addr like so

if (!empty($addr) && preg_match($this->regex, $addr)) {

Steps to Reproduce the Issue

1. use one of the instances where this function is called
2. make sure the $addr is empty

Context

No response

Version

8.7.0

What browser are you currently using?

Firefox

Browser Version

133.0 (64-bit)

Environment Information

PHP 8.2, Mysql 5.7.33

Operating System and Version

Windows 11 23H

@AlexMyddleware AlexMyddleware added the Type: Bug Something isn't working label Dec 2, 2024
@johnM2401 johnM2401 added Priority:Important Issues & PRs that are important; broken functions; errors; there are workarounds Severity: Moderate Minor Impact labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Important Issues & PRs that are important; broken functions; errors; there are workarounds Severity: Moderate Minor Impact Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants