summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-02-16 15:37:04 +0300
committerDmitry Stogov <dmitry@zend.com>2018-02-16 15:37:04 +0300
commitb4112ea288b41d1f26ae5248beb18bccb4ca9b2d (patch)
tree3c3776bc3c3fe2b7b1f560959cbaf5bc2044de7f /Zend/zend_execute.h
parente5db3054a15904627beeb8a3cd3fe2c949f7eb6c (diff)
downloadphp-git-b4112ea288b41d1f26ae5248beb18bccb4ca9b2d.tar.gz
Don't make expectations about non-constant zval refcauntability
Diffstat (limited to 'Zend/zend_execute.h')
-rw-r--r--Zend/zend_execute.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 21c8ed7b6b..5da2e2d9b1 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -92,10 +92,14 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
garbage = Z_COUNTED_P(variable_ptr);
if (GC_DELREF(garbage) == 0) {
ZVAL_COPY_VALUE(variable_ptr, value);
- if (value_type & (IS_CONST|IS_CV)) {
+ if (ZEND_CONST_COND(value_type == IS_CONST, 0)) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}
+ } else if (value_type & (IS_CONST|IS_CV)) {
+ if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
+ Z_ADDREF_P(variable_ptr);
+ }
} else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) {
if (UNEXPECTED(GC_DELREF(ref) == 0)) {
efree_size(ref, sizeof(zend_reference));
@@ -115,10 +119,14 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
} while (0);
ZVAL_COPY_VALUE(variable_ptr, value);
- if (value_type & (IS_CONST|IS_CV)) {
+ if (ZEND_CONST_COND(value_type == IS_CONST, 0)) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}
+ } else if (value_type & (IS_CONST|IS_CV)) {
+ if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
+ Z_ADDREF_P(variable_ptr);
+ }
} else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) {
if (UNEXPECTED(GC_DELREF(ref) == 0)) {
efree_size(ref, sizeof(zend_reference));