1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Zend: remove zval_dtor() compatibility macro

This is an alias for zval_ptr_dtor_nogc().
I've seen people make mistakes against this and use zval_dtor() instead
of zval_ptr_dtor(). The crucial detail here is that the former won't
root possible GC cycles while the latter will.
We can avoid the confusion by just retiring this compatibility macro.

Closes GH-20235.
This commit is contained in:
Niels Dossche
2025-10-20 00:10:40 +02:00
parent 9c90e16e18
commit df8ce6ddbd
3 changed files with 3 additions and 4 deletions

View File

@@ -32,6 +32,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
. ZEND_LTOA() (and ZEND_LTOA_BUF_LEN) has been removed, as it was
unsafe. Directly use ZEND_LONG_FMT with a function from the
printf family.
. The zval_dtor() alias of zval_ptr_dtor_nogc() has been removed.
Call zval_ptr_dtor_nogc() directly instead.
========================
2. Build system changes

View File

@@ -81,9 +81,6 @@ ZEND_API void zval_ptr_dtor(zval *zval_ptr);
ZEND_API void zval_ptr_safe_dtor(zval *zval_ptr);
ZEND_API void zval_internal_ptr_dtor(zval *zvalue);
/* Kept for compatibility */
#define zval_dtor(zvalue) zval_ptr_dtor_nogc(zvalue)
ZEND_API void zval_add_ref(zval *p);
END_EXTERN_C()

View File

@@ -1052,7 +1052,7 @@ PHP_METHOD(PDOStatement, fetch)
array_init_size(return_value, 1);
bool success = pdo_do_key_pair_fetch(stmt, ori, off, Z_ARRVAL_P(return_value));
if (!success) {
zval_dtor(return_value);
zval_ptr_dtor_nogc(return_value);
PDO_HANDLE_STMT_ERR();
RETURN_FALSE;
}