Fixed type inference

Fixes oss-fuzz #51640
This commit is contained in:
Dmitry Stogov 2022-09-26 12:19:12 +03:00
parent 2ed103f733
commit 94b8c2da9f
2 changed files with 21 additions and 2 deletions

View file

@ -2322,9 +2322,9 @@ static zend_always_inline zend_result _zend_update_type_info(
if (ssa_op->op2_def >= 0 && !(ssa_var_info[ssa_op->op2_def].type & MAY_BE_REF)) {
UPDATE_SSA_TYPE(tmp, ssa_op->op2_def);
}
if (opline->opcode == ZEND_ASSIGN_OP
|| opline->opcode == ZEND_ASSIGN_DIM_OP
if (opline->opcode == ZEND_ASSIGN_DIM_OP
|| opline->opcode == ZEND_ASSIGN_OBJ_OP
|| opline->opcode == ZEND_ASSIGN_STATIC_PROP_OP
|| opline->opcode == ZEND_ASSIGN_DIM
|| opline->opcode == ZEND_ASSIGN_OBJ) {
if ((ssa_op+1)->op1_def >= 0 && !(ssa_var_info[(ssa_op+1)->op1_def].type & MAY_BE_REF)) {

View file

@ -0,0 +1,19 @@
--TEST--
Type inference 021;
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--FILE--
<?php
function foo() {
for(;;){
$b->y++;
$b *= $a;
$a++;
}
}
?>
DONE
--EXPECT--
DONE