Fix #577 - Fix empty addr variable creating logs

This commit is contained in:
y.yerli 2025-01-14 18:13:00 +03:00
parent a2ff98643a
commit bb4afd4b56

View file

@ -872,10 +872,7 @@ class SugarEmailAddress extends SugarBean
$optOut = '' $optOut = ''
) { ) {
if (!is_array($new_addrs)) { if (!is_array($new_addrs)) {
$GLOBALS['log']->fatal( $new_addrs = array($new_addrs);
'Invalid Argument: new address should be an array of strings, ' .
gettype($new_addrs) . ' given.'
);
} }
$module = $this->getCorrectedModule($module); $module = $this->getCorrectedModule($module);
//One last check for the ConvertLead action in which case we need to change $module to 'Leads' //One last check for the ConvertLead action in which case we need to change $module to 'Leads'
@ -1083,6 +1080,11 @@ class SugarEmailAddress extends SugarBean
$optIn = null $optIn = null
) { ) {
$addr = html_entity_decode($addr, ENT_QUOTES); $addr = html_entity_decode($addr, ENT_QUOTES);
if (empty($addr)) {
return;
}
if (preg_match($this->regex, $addr)) { if (preg_match($this->regex, $addr)) {
$primaryFlag = ($primary) ? '1' : '0'; $primaryFlag = ($primary) ? '1' : '0';
$replyToFlag = ($replyTo) ? '1' : '0'; $replyToFlag = ($replyTo) ? '1' : '0';