Skip to content

Commit 5c05d8c

Browse files
committed
Fix inference of COPY_TMP
Since phpGH-11592 COPY_TMP may receive and thus define references. Unfortunately, the name COPY_TMP is no longer accurate.
1 parent 637d257 commit 5c05d8c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2698,7 +2698,10 @@ static zend_always_inline zend_result _zend_update_type_info(
26982698
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
26992699
COPY_SSA_OBJ_TYPE(ssa_op->op1_use, ssa_op->op1_def);
27002700
}
2701-
tmp = t1 & ~(MAY_BE_UNDEF|MAY_BE_REF);
2701+
tmp = t1 & ~MAY_BE_UNDEF;
2702+
if (opline->opcode != ZEND_COPY_TMP || opline->op1_type != IS_VAR) {
2703+
tmp &= ~MAY_BE_REF;
2704+
}
27022705
if (t1 & MAY_BE_UNDEF) {
27032706
tmp |= MAY_BE_NULL;
27042707
}

Zend/zend_vm_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9538,6 +9538,7 @@ ZEND_VM_HANDLER(172, ZEND_FUNC_GET_ARGS, UNUSED|CONST, UNUSED)
95389538
ZEND_VM_NEXT_OPCODE();
95399539
}
95409540

9541+
/* Contrary to what its name indicates, ZEND_COPY_TMP may receive and define references. */
95419542
ZEND_VM_HANDLER(167, ZEND_COPY_TMP, TMPVAR, UNUSED)
95429543
{
95439544
USE_OPLINE

Zend/zend_vm_execute.h

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)