[php-src] master: Zend: use ZVAL_COPY_DEREF when possible (#23694)
| From: | Nora Dossche via GitHub | Date: | Tue, 15 Sep 2026 19:48:15 +0000 |
| Subject: | [php-src] master: Zend: use ZVAL_COPY_DEREF when possible (#23694) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141216@lists.php.net to get a copy of this message | ||
Author: Nora Dossche (ndossche)
Committer: GitHub (web-flow)
Pusher: ndossche
Date: 2026-09-15T21:48:12+02:00
Commit: https://github.com/php/php-src/commit/c6a9d69356f6ebf22dd60df047a8df8ae04ee74e
Raw diff: https://github.com/php/php-src/commit/c6a9d69356f6ebf22dd60df047a8df8ae04ee74e.diff
Zend: use ZVAL_COPY_DEREF when possible (#23694)
Cleaner, but also an optimized macro.
Changed paths:
M Zend/zend_exceptions.c
M Zend/zend_execute.c
Diff:
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 062ba0f3b188..9702a335d461 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -462,8 +462,7 @@ ZEND_METHOD(Exception, getCode)
ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_CODE);
- ZVAL_DEREF(prop);
- ZVAL_COPY(return_value, prop);
+ ZVAL_COPY_DEREF(return_value, prop);
}
/* }}} */
@@ -475,8 +474,7 @@ ZEND_METHOD(Exception, getTrace)
ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_TRACE);
- ZVAL_DEREF(prop);
- ZVAL_COPY(return_value, prop);
+ ZVAL_COPY_DEREF(return_value, prop);
}
/* }}} */
@@ -488,8 +486,7 @@ ZEND_METHOD(ErrorException, getSeverity)
ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_SEVERITY);
- ZVAL_DEREF(prop);
- ZVAL_COPY(return_value, prop);
+ ZVAL_COPY_DEREF(return_value, prop);
}
/* }}} */
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 14a340ffee37..9047550cafb0 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1080,8 +1080,7 @@ static zend_never_inline zval* zend_assign_to_typed_prop(const
zend_property_inf
}
}
- ZVAL_DEREF(value);
- ZVAL_COPY(&tmp, value);
+ ZVAL_COPY_DEREF(&tmp, value);
if (UNEXPECTED(!i_zend_verify_property_type(info, &tmp, EX_USES_STRICT_TYPES()))) {
zval_ptr_dtor(&tmp);