java-topology/defects/suitecrm/patch/suitecrm-0001-inboundemail-uids-in_array.patch

20 lines
874 B
Diff

# UNDF: UNDF-2026-000000871
--- a/modules/InboundEmail/InboundEmail.php
+++ b/modules/InboundEmail/InboundEmail.php
@@ -1236,6 +1236,7 @@
$r = $this->db->query($q);
$uids = array();
+ $uidsSet = array(); // O(1) lookup instead of O(N) in_array
while ($a = $this->db->fetchByAssoc($r)) {
$uids[] = $a['imap_uid'];
+ $uidsSet[$a['imap_uid']] = true;
}
@@ -1261,7 +1263,7 @@
}
foreach ($insert as $overview) {
- if (in_array($overview->imap_uid, $uids)) {
+ if (isset($uidsSet[$overview->imap_uid])) {
// fixing bug #49543: setting 'mbox' property for the following updating of other items in this box
if (!isset($overview->mbox)) {
$overview->mbox = $mbox;