Skip to content

Commit df8ce6d

Browse files
committed
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.
1 parent 9c90e16 commit df8ce6d

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
3232
. ZEND_LTOA() (and ZEND_LTOA_BUF_LEN) has been removed, as it was
3333
unsafe. Directly use ZEND_LONG_FMT with a function from the
3434
printf family.
35+
. The zval_dtor() alias of zval_ptr_dtor_nogc() has been removed.
36+
Call zval_ptr_dtor_nogc() directly instead.
3537

3638
========================
3739
2. Build system changes

Zend/zend_variables.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ ZEND_API void zval_ptr_dtor(zval *zval_ptr);
8181
ZEND_API void zval_ptr_safe_dtor(zval *zval_ptr);
8282
ZEND_API void zval_internal_ptr_dtor(zval *zvalue);
8383

84-
/* Kept for compatibility */
85-
#define zval_dtor(zvalue) zval_ptr_dtor_nogc(zvalue)
86-
8784
ZEND_API void zval_add_ref(zval *p);
8885

8986
END_EXTERN_C()

ext/pdo/pdo_stmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ PHP_METHOD(PDOStatement, fetch)
10521052
array_init_size(return_value, 1);
10531053
bool success = pdo_do_key_pair_fetch(stmt, ori, off, Z_ARRVAL_P(return_value));
10541054
if (!success) {
1055-
zval_dtor(return_value);
1055+
zval_ptr_dtor_nogc(return_value);
10561056
PDO_HANDLE_STMT_ERR();
10571057
RETURN_FALSE;
10581058
}

0 commit comments

Comments
 (0)