mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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)).
This commit is contained in:
parent
3f6a9c9b7b
commit
e11468a79b
2 changed files with 2 additions and 8 deletions
|
@ -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,
|
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_arrayaccess, zend_ce_countable, zend_ce_iterator, zend_ce_serializable, zend_ce_stringable,
|
||||||
zend_ce_traversable.
|
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*"
|
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.filename now is zend_string*
|
||||||
- zend_file_handle.free_filename is removed. Now zend_file_handle.filename is always released.
|
- zend_file_handle.free_filename is removed. Now zend_file_handle.filename is always released.
|
||||||
|
|
|
@ -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; \
|
Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \
|
||||||
} while (0)
|
} 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 { \
|
#define ZVAL_NEW_PERSISTENT_ARR(z) do { \
|
||||||
zval *__z = (z); \
|
zval *__z = (z); \
|
||||||
zend_array *_arr = \
|
zend_array *_arr = \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue