Skip to content

Commit ebd1a0a

Browse files
committed
Properly check if BIND_STATIC may throw
1 parent b610dce commit ebd1a0a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4558,9 +4558,11 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze
45584558
if (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) {
45594559
/* Destructor may throw. */
45604560
return 1;
4561+
} else {
4562+
zval *value = (zval*)((char*)op_array->static_variables + (opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT)));
4563+
/* May throw if initializer is CONSTANT_AST. */
4564+
return Z_TYPE_P(value) == IS_CONSTANT_AST;
45614565
}
4562-
/* TODO: May not throw if initializer is not CONSTANT_AST. */
4563-
return 1;
45644566
case ZEND_ASSIGN_DIM:
45654567
if ((opline+1)->op1_type == IS_CV) {
45664568
if (_ssa_op1_info(op_array, ssa, opline+1, ssa_op+1) & MAY_BE_UNDEF) {

0 commit comments

Comments
 (0)