Skip to content

Commit b991741

Browse files
committed
Fixed reference counting
1 parent b1a03d7 commit b991741

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Zend/zend_execute.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ static zend_always_inline void zend_assign_to_object(zval *retval, zval *object,
10441044
}
10451045

10461046
if (!zobj->ce->__set) {
1047-
zval *ref = NULL;
1047+
zend_reference *ref = NULL;
10481048

10491049
if (EXPECTED(zobj->properties == NULL)) {
10501050
rebuild_object_properties(zobj);
@@ -1058,8 +1058,8 @@ static zend_always_inline void zend_assign_to_object(zval *retval, zval *object,
10581058
}
10591059
} else if (value_type != IS_TMP_VAR) {
10601060
if (Z_ISREF_P(value)) {
1061-
if (value_type == IS_CV) {
1062-
ref = value;
1061+
if (value_type == IS_VAR) {
1062+
ref = Z_REF_P(value);
10631063
}
10641064
value = Z_REFVAL_P(value);
10651065
if (Z_REFCOUNTED_P(value)) {
@@ -1074,7 +1074,9 @@ static zend_always_inline void zend_assign_to_object(zval *retval, zval *object,
10741074
ZVAL_COPY(retval, value);
10751075
}
10761076
if (/*value_type == IS_VAR &&*/ ref) {
1077-
efree_size(ref, sizeof(zend_reference));
1077+
if (UNEXPECTED(--GC_REFCOUNT(ref) == 0)) {
1078+
efree_size(ref, sizeof(zend_reference));
1079+
}
10781080
}
10791081
return;
10801082
}

0 commit comments

Comments
 (0)