- Issue created by @berramou
- Status changed to Needs review
15 days ago 9:39pm 21 July 2025
The check for spam words returning false positives should only flag exact matches, not words that contain the target word. For example, 'SEO' should be blocked, but 'SEOul' (the capital of South Korea 😉) should not.
this condition if (strpos($value, mb_strtolower(trim($word))) !== FALSE)
will return true in the SEO vs SEOul case.
It's better to add a check for exact word something like
protected function isExactWordExist(string $phrase, string $word): bool {
// Trim and lowercase the word for comparison.
$word = mb_strtolower(trim($word));
$phrase = mb_strtolower($phrase);
// Use regex with word boundaries to check for the exact word.
return preg_match("/\b" . preg_quote($word, '/') . "\b/", $phrase) === 1;
}
Active
3.0
Code