Skip to content

Commit

Permalink
Properly check if BIND_STATIC may throw
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Sep 13, 2021
1 parent b610dce commit ebd1a0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/opcache/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -4558,9 +4558,11 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze
if (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) {
/* Destructor may throw. */
return 1;
} else {
zval *value = (zval*)((char*)op_array->static_variables + (opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT)));
/* May throw if initializer is CONSTANT_AST. */
return Z_TYPE_P(value) == IS_CONSTANT_AST;
}
/* TODO: May not throw if initializer is not CONSTANT_AST. */
return 1;
case ZEND_ASSIGN_DIM:
if ((opline+1)->op1_type == IS_CV) {
if (_ssa_op1_info(op_array, ssa, opline+1, ssa_op+1) & MAY_BE_UNDEF) {
Expand Down

0 comments on commit ebd1a0a

Please sign in to comment.