We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e87cfa commit 5dd5a42Copy full SHA for 5dd5a42
ext/enchant/enchant.c
@@ -671,17 +671,18 @@ PHP_FUNCTION(enchant_dict_suggest)
671
}
672
673
PHP_ENCHANT_GET_DICT;
674
- array_init(return_value);
675
676
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
677
if (suggs && n_sugg) {
678
- size_t i;
+ array_init_size(return_value, n_sugg);
679
680
- for (i = 0; i < n_sugg; i++) {
+ for (size_t i = 0; i < n_sugg; i++) {
681
add_next_index_string(return_value, suggs[i]);
682
683
684
enchant_dict_free_string_list(pdict->pdict, suggs);
+ } else {
685
+ RETURN_EMPTY_ARRAY();
686
687
688
/* }}} */
0 commit comments