Skip to content

Commit 0bffee4

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79311: enchant_dict_suggest() fails on big endian architecture
2 parents a7de98f + 6adb885 commit 0bffee4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ PHP NEWS
2626
cmb)
2727
. Fixed bug #79271 (DOMDocumentType::$childNodes is NULL). (cmb)
2828

29+
- Enchant:
30+
. Fixed bug #79311 (enchant_dict_suggest() fails on big endian architecture).
31+
(cmb)
32+
2933
- FPM:
3034
. Fixed bug #77653 (operator displayed instead of the real error message).
3135
(Jakub Zelenka)

ext/enchant/enchant.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -725,18 +725,16 @@ PHP_FUNCTION(enchant_dict_quick_check)
725725
PHP_ENCHANT_GET_DICT;
726726

727727
if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
728-
int n_sugg;
729-
size_t n_sugg_st;
728+
size_t n_sugg;
730729
char **suggs;
731730

732731
if (!sugg && ZEND_NUM_ARGS() == 2) {
733732
RETURN_FALSE;
734733
}
735734

736-
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
737-
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
735+
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
738736
if (suggs && n_sugg) {
739-
int i;
737+
size_t i;
740738
for (i = 0; i < n_sugg; i++) {
741739
add_next_index_string(sugg, suggs[i]);
742740
}
@@ -778,19 +776,17 @@ PHP_FUNCTION(enchant_dict_suggest)
778776
size_t wordlen;
779777
char **suggs;
780778
enchant_dict *pdict;
781-
int n_sugg;
782-
size_t n_sugg_st;
779+
size_t n_sugg;
783780

784781
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
785782
RETURN_FALSE;
786783
}
787784

788785
PHP_ENCHANT_GET_DICT;
789786

790-
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
791-
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
787+
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
792788
if (suggs && n_sugg) {
793-
int i;
789+
size_t i;
794790

795791
array_init(return_value);
796792
for (i = 0; i < n_sugg; i++) {

0 commit comments

Comments
 (0)