Skip to content

Commit 4495594

Browse files
authored
ext/intl: Use zval_get_tmp_string where possible (#18966)
1 parent 22e444c commit 4495594

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/intl/listformatter/listformatter_class.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,17 @@ PHP_METHOD(IntlListFormatter, format)
135135
zval *val;
136136

137137
ZEND_HASH_FOREACH_VAL(ht, val) {
138-
zend_string *str_val;
138+
zend_string *str_val, *tmp_str;
139139

140-
str_val = zval_get_string(val);
140+
str_val = zval_get_tmp_string(val, &tmp_str);
141141

142142
// Convert PHP string to UTF-16
143143
UChar *ustr = NULL;
144144
int32_t ustr_len = 0;
145145
UErrorCode status = U_ZERO_ERROR;
146146

147147
intl_convert_utf8_to_utf16(&ustr, &ustr_len, ZSTR_VAL(str_val), ZSTR_LEN(str_val), &status);
148-
zend_string_release(str_val);
148+
zend_tmp_string_release(tmp_str);
149149

150150
if (U_FAILURE(status)) {
151151
// We can't use goto cleanup because items and itemLengths are incompletely allocated

0 commit comments

Comments
 (0)