Fix PHP 7.2: count(): Parameter must be an array in enchant-based spellchecker (#6234)

pull/6465/head
Aleksander Machniak 6 years ago
parent 60902de521
commit 9efd534fe1

@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
===========================
- Fix parsing date strings (e.g. from a Date: mail header) with comments (#6216)
- Fix PHP 7.2: count(): Parameter must be an array in enchant-based spellchecker (#6234)
RELEASE 1.3.5
-------------

@ -101,7 +101,7 @@ class rcube_spellcheck_enchant extends rcube_spellcheck_engine
else if (!enchant_dict_check($this->enchant_dictionary, $word)) {
$suggestions = enchant_dict_suggest($this->enchant_dictionary, $word);
if (count($suggestions) > self::MAX_SUGGESTIONS) {
if (is_array($suggestions) && count($suggestions) > self::MAX_SUGGESTIONS) {
$suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
}
@ -130,7 +130,7 @@ class rcube_spellcheck_enchant extends rcube_spellcheck_engine
$suggestions = enchant_dict_suggest($this->enchant_dictionary, $word);
if (count($suggestions) > self::MAX_SUGGESTIONS)
if (is_array($suggestions) && count($suggestions) > self::MAX_SUGGESTIONS)
$suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
return is_array($suggestions) ? $suggestions : array();

Loading…
Cancel
Save