Skip to content

Commit c9b5ad0

Browse files
committed
Merge branch 'master' into jit-dynasm
* master: Detect undefined variable usage
2 parents b594ad7 + 4406452 commit c9b5ad0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4174,6 +4174,11 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
41744174
case ZEND_UNSET_VAR:
41754175
return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY));
41764176
case ZEND_ASSIGN_DIM:
4177+
if ((opline+1)->op1_type == IS_CV) {
4178+
if (_ssa_op1_info(op_array, ssa, opline+1) & MAY_BE_UNDEF) {
4179+
return 1;
4180+
}
4181+
}
41774182
return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE)) || opline->op2_type == IS_UNUSED ||
41784183
(t2 & (MAY_BE_UNDEF|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
41794184
case ZEND_ASSIGN_OBJ:

0 commit comments

Comments
 (0)