From 87bcf324f6960a289a4e5a8ea5a0196c285bebbb Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sun, 12 Mar 2023 14:13:56 +0100 Subject: [PATCH] Fix RC1 assumption for typed properties with __get Unsetting typed properties resorts back to __get which may have RC1. --- Zend/Optimizer/zend_inference.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 17373db2b636a..ecfa71570b247 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -3444,16 +3444,12 @@ static zend_always_inline int _zend_update_type_info( } else if (ssa_op->op1_use >= 0 && !ssa->var_info[ssa_op->op1_use].is_instanceof) { ce = ssa->var_info[ssa_op->op1_use].ce; } - if (prop_info) { - /* FETCH_OBJ_R/IS for plain property increments reference counter, - so it can't be 1 */ - if (ce && !ce->create_object && !result_may_be_separated(ssa, ssa_op)) { - tmp &= ~MAY_BE_RC1; - } - } else { - if (ce && !ce->create_object && !ce->__get && !result_may_be_separated(ssa, ssa_op)) { - tmp &= ~MAY_BE_RC1; - } + /* Unset typed properties will resort back to __get/__set */ + if (ce + && !ce->create_object + && !ce->__get + && !result_may_be_separated(ssa, ssa_op)) { + tmp &= ~MAY_BE_RC1; } if (opline->opcode == ZEND_FETCH_OBJ_IS) { /* IS check may return null for uninitialized typed property. */