Skip to content

Commit 518fe3f

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 52b13f6 commit 518fe3f

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
@@ -2697,7 +2697,10 @@ static zend_always_inline zend_result _zend_update_type_info(
26972697
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
26982698
COPY_SSA_OBJ_TYPE(ssa_op->op1_use, ssa_op->op1_def);
26992699
}
2700-
tmp = t1 & ~(MAY_BE_UNDEF|MAY_BE_REF);
2700+
tmp = t1 & ~MAY_BE_UNDEF;
2701+
if (opline->opcode != ZEND_COPY_TMP || opline->op1_type != IS_VAR) {
2702+
tmp &= ~MAY_BE_REF;
2703+
}
27012704
if (t1 & MAY_BE_UNDEF) {
27022705
tmp |= MAY_BE_NULL;
27032706
}

Zend/zend_vm_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9516,6 +9516,7 @@ ZEND_VM_HANDLER(172, ZEND_FUNC_GET_ARGS, UNUSED|CONST, UNUSED)
95169516
ZEND_VM_NEXT_OPCODE();
95179517
}
95189518

9519+
/* Contrary to what its name indicates, ZEND_COPY_TMP may receive and define references. */
95199520
ZEND_VM_HANDLER(167, ZEND_COPY_TMP, TMPVAR, UNUSED)
95209521
{
95219522
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)