1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 17:38:14 +02:00

It's safer to use zval_ptr_dtor() for iterator keys.

This commit is contained in:
Dmitry Stogov
2018-07-05 16:56:52 +03:00
parent d0a6b1009f
commit 43d5a3665d
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -1439,7 +1439,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
}
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
zval_ptr_dtor(&key);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1567,7 +1567,7 @@ phar_spl_fileinfo:
}
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
zval_ptr_dtor(&key);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
+1 -1
View File
@@ -2266,7 +2266,7 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
}
array_set_zval_key(Z_ARRVAL(array_copy), &key, val);
zval_ptr_dtor(val);
zval_dtor(&key);
zval_ptr_dtor(&key);
} else {
add_next_index_zval(&array_copy, val);
}