Skip to content

Commit 3175f24

Browse files
committed
Fix RC1 assumption for typed properties with __get
Unsetting typed properties resorts back to __get which may have RC1. Closes GH-10833
1 parent 71c6372 commit 3175f24

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3444,16 +3444,12 @@ static zend_always_inline int _zend_update_type_info(
34443444
} else if (ssa_op->op1_use >= 0 && !ssa->var_info[ssa_op->op1_use].is_instanceof) {
34453445
ce = ssa->var_info[ssa_op->op1_use].ce;
34463446
}
3447-
if (prop_info) {
3448-
/* FETCH_OBJ_R/IS for plain property increments reference counter,
3449-
so it can't be 1 */
3450-
if (ce && !ce->create_object && !result_may_be_separated(ssa, ssa_op)) {
3451-
tmp &= ~MAY_BE_RC1;
3452-
}
3453-
} else {
3454-
if (ce && !ce->create_object && !ce->__get && !result_may_be_separated(ssa, ssa_op)) {
3455-
tmp &= ~MAY_BE_RC1;
3456-
}
3447+
/* Unset properties will resort back to __get/__set */
3448+
if (ce
3449+
&& !ce->create_object
3450+
&& !ce->__get
3451+
&& !result_may_be_separated(ssa, ssa_op)) {
3452+
tmp &= ~MAY_BE_RC1;
34573453
}
34583454
if (opline->opcode == ZEND_FETCH_OBJ_IS) {
34593455
/* IS check may return null for uninitialized typed property. */

0 commit comments

Comments
 (0)