Missed two iSpamScore to be int instead of float

This commit is contained in:
djmaze 2021-11-08 20:56:18 +01:00
parent 35433ca5b0
commit adf1086c03

View file

@ -455,14 +455,14 @@ class Message implements \JsonSerializable
$this->sSpamResult = $spam;
$this->bIsSpam = !!\preg_match('/yes|spam/', $spam);
if (\preg_match('/spamicity=([\\d\\.]+)/', $spam, $spamicity)) {
$this->iSpamScore = \max(0, \min(100, \floatval($spamicity[1])));
$this->iSpamScore = \intval(\max(0, \min(100, \floatval($spamicity[1]))));
}
} else if ($spam = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_SPAM_STATUS)) {
$this->sSpamResult = $spam;
if (\preg_match('/(?:hits|score)=([\\d\\.-]+)/', $spam, $value)
&& \preg_match('/required=([\\d\\.-]+)/', $spam, $required)) {
if ($threshold = \floatval($required[1])) {
$this->iSpamScore = \max(0, \min(100, 100 * \floatval($value[1]) / $threshold));
$this->iSpamScore = \intval(\max(0, \min(100, 100 * \floatval($value[1]) / $threshold)));
$this->sSpamResult = "{$value[1]} / {$required[1]}";
}
}