Skip to content

Commit b1a49ff

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix RC1 assumption for typed properties with __get
2 parents 6a44705 + 3175f24 commit b1a49ff

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
@@ -3481,16 +3481,12 @@ static zend_always_inline zend_result _zend_update_type_info(
34813481
} else if (ssa_op->op1_use >= 0 && !ssa->var_info[ssa_op->op1_use].is_instanceof) {
34823482
ce = ssa->var_info[ssa_op->op1_use].ce;
34833483
}
3484-
if (prop_info) {
3485-
/* FETCH_OBJ_R/IS for plain property increments reference counter,
3486-
so it can't be 1 */
3487-
if (ce && !ce->create_object && !result_may_be_separated(ssa, ssa_op)) {
3488-
tmp &= ~MAY_BE_RC1;
3489-
}
3490-
} else {
3491-
if (ce && !ce->create_object && !ce->__get && !result_may_be_separated(ssa, ssa_op)) {
3492-
tmp &= ~MAY_BE_RC1;
3493-
}
3484+
/* Unset properties will resort back to __get/__set */
3485+
if (ce
3486+
&& !ce->create_object
3487+
&& !ce->__get
3488+
&& !result_may_be_separated(ssa, ssa_op)) {
3489+
tmp &= ~MAY_BE_RC1;
34943490
}
34953491
if (opline->opcode == ZEND_FETCH_OBJ_IS) {
34963492
/* IS check may return null for uninitialized typed property. */

0 commit comments

Comments
 (0)