Skip to content

Commit e11468a

Browse files
committed
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)).
1 parent 3f6a9c9 commit e11468a

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ PHP 8.1 INTERNALS UPGRADE NOTES
2323
spl_ce_Stringable, spl_ce_Traversable alias class entries have been removed in favor of zend_ce_aggregate,
2424
zend_ce_arrayaccess, zend_ce_countable, zend_ce_iterator, zend_ce_serializable, zend_ce_stringable,
2525
zend_ce_traversable.
26+
- The ZVAL_NEW_ARR() macro has been removed. Use array_init() or ZVAL_ARR
27+
with zend_new_array() instead.
2628
b. Zend Stream API has been changed to use "zend_string*" instead of "char*"
2729
- zend_file_handle.filename now is zend_string*
2830
- zend_file_handle.free_filename is removed. Now zend_file_handle.filename is always released.

Zend/zend_types.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -957,14 +957,6 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
957957
Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \
958958
} while (0)
959959

960-
#define ZVAL_NEW_ARR(z) do { \
961-
zval *__z = (z); \
962-
zend_array *_arr = \
963-
(zend_array *) emalloc(sizeof(zend_array)); \
964-
Z_ARR_P(__z) = _arr; \
965-
Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \
966-
} while (0)
967-
968960
#define ZVAL_NEW_PERSISTENT_ARR(z) do { \
969961
zval *__z = (z); \
970962
zend_array *_arr = \

0 commit comments

Comments
 (0)