Skip to content

Commit 2ecf129

Browse files
committed
SUPP0RT-671: Filtered out invalid email addresses
1 parent 1fd6247 commit 2ecf129

File tree

1 file changed

+4
-1
lines changed
  • web/profiles/custom/os2loop/modules/os2loop_alert/src/Helper

1 file changed

+4
-1
lines changed

web/profiles/custom/os2loop/modules/os2loop_alert/src/Helper/Helper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ public function getUserEmails(array $userIds = NULL): array {
123123
$query->condition('uid', $userIds ?: [-1], 'IN');
124124
}
125125

126-
return $query
126+
$emails = $query
127127
->execute()
128128
->fetchCol();
129+
130+
// Return only valid emails.
131+
return array_filter($emails, fn (string $email) => filter_var($email, FILTER_VALIDATE_EMAIL));
129132
}
130133

131134
/**

0 commit comments

Comments
 (0)