You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code is using str_word_count so many times, the problem with this function is that when Unicode strings are provided it returns a excessively high number which will make the spam detector miss some spam situations.
The only substitute function that worked fine for me was this one:
/**
* Returns number of words in a unicode string
* @param $string
* @param int $mode
* @return array|int
*/
function utf8WordCount($string, $mode = 0) {
static $it = NULL;
if (is_null($it)) {
$it = IntlBreakIterator::createWordInstance(ini_get('intl.default_locale'));
}
$l = 0;
$it->setText($string);
$ret = $mode == 0 ? 0 : array();
if (IntlBreakIterator::DONE != ($u = $it->first())) {
do {
if (IntlBreakIterator::WORD_NONE != $it->getRuleStatus()) {
$mode == 0 ? ++$ret : $ret[] = substr($string, $l, $u - $l);
}
$l = $u;
} while (IntlBreakIterator::DONE != ($u = $it->next()));
}
return $ret;
}
The text was updated successfully, but these errors were encountered:
@morrelinko You're welcome, I did not use this function in your code since it seems incompatible as it only receives one argument, I extended the rife detector and rewrote the check function using this one for my self; So it's wise that you use this function in the code yourself and then conduct necessary test or checks.
The code is using str_word_count so many times, the problem with this function is that when Unicode strings are provided it returns a excessively high number which will make the spam detector miss some spam situations.
The only substitute function that worked fine for me was this one:
The text was updated successfully, but these errors were encountered: