From e11468a79bd5d39b5418da80780fa1c2117e4c43 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 7 Jun 2021 12:48:15 +0200 Subject: [PATCH] Remove ZVAL_NEW_ARR() macro This macro is a footgun because it creates an uninitialized array (only an allocation). This macro is no longer used in php-src, and we have better alternatives like array_init() or ZVAL_ARR(arr, zend_new_array(size_hint)). --- UPGRADING.INTERNALS | 2 ++ Zend/zend_types.h | 8 -------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 3e0428fc8e3..b40235b8ea1 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -23,6 +23,8 @@ PHP 8.1 INTERNALS UPGRADE NOTES spl_ce_Stringable, spl_ce_Traversable alias class entries have been removed in favor of zend_ce_aggregate, zend_ce_arrayaccess, zend_ce_countable, zend_ce_iterator, zend_ce_serializable, zend_ce_stringable, zend_ce_traversable. + - The ZVAL_NEW_ARR() macro has been removed. Use array_init() or ZVAL_ARR + with zend_new_array() instead. b. Zend Stream API has been changed to use "zend_string*" instead of "char*" - zend_file_handle.filename now is zend_string* - zend_file_handle.free_filename is removed. Now zend_file_handle.filename is always released. diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 863dd6adcd3..963362222d0 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -957,14 +957,6 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) { Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \ } while (0) -#define ZVAL_NEW_ARR(z) do { \ - zval *__z = (z); \ - zend_array *_arr = \ - (zend_array *) emalloc(sizeof(zend_array)); \ - Z_ARR_P(__z) = _arr; \ - Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \ - } while (0) - #define ZVAL_NEW_PERSISTENT_ARR(z) do { \ zval *__z = (z); \ zend_array *_arr = \