From c0ed491f7ac2be8e90759b08db3bd54342d53ed2 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 6 Aug 2024 12:25:39 +0200 Subject: [PATCH] Bugfix: Division by zero #1694 --- snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php index 8f6668704..fa8c9cf2e 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php @@ -253,8 +253,10 @@ class Message implements \JsonSerializable else if (\preg_match('@([\\d\\.]+)/([\\d\\.]+)@', $spam, $value) || \preg_match('@([\\d\\.]+)/([\\d\\.]+)@', $oHeaders->ValueByName(MimeHeader::X_SPAM_INFO), $value) ) { - $oMessage->sSpamResult = "{$value[1]} / {$value[2]}"; - $oMessage->setSpamScore(100 * \floatval($value[1]) / \floatval($value[2])); + if ($threshold = \floatval($value[2])) { + $oMessage->setSpamScore(100 * \floatval($value[1]) / $threshold); + $oMessage->sSpamResult = "{$value[1]} / {$value[2]}"; + } } $oMessage->bIsSpam = 'Yes' === \substr($spam, 0, 3)