diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-03-01 21:45:23 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-03-01 21:47:43 +0300 |
commit | 0b249c188181110a4f2ecb6ec4a9d91fef041579 (patch) | |
tree | 03815667318ef5ea230a1030a4dd11061b6ef80c /lib | |
parent | 73efd7dab4e3a2f202df31d38ac69b049dc02c0e (diff) |
Do now allow messages to be their own parents in threading
A message may send its own ID in the `references` header. In that case
the threading algorithm must ignore the closed loop and not set the
message as its own parent, to prevent an infinite loop later when
checking for anchestors.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/IMAP/Threading/ThreadBuilder.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/IMAP/Threading/ThreadBuilder.php b/lib/IMAP/Threading/ThreadBuilder.php index 84bcc8cb3..2b3c18f82 100644 --- a/lib/IMAP/Threading/ThreadBuilder.php +++ b/lib/IMAP/Threading/ThreadBuilder.php @@ -114,7 +114,7 @@ class ThreadBuilder { // Step 1.C //$parentId = $message->getReferences()[count($message->getReferences()) - 1] ?? null; //$container->setParent($idTable[$parentId] ?? null); - if ($parent === null || !$parent->hasAncestor($container)) { + if (($parent === null || !$parent->hasAncestor($container)) && $container !== $parent) { $container->setParent($parent); } } |