Skip to content

Commit 6d1a2b3

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Properly check if BIND_STATIC may throw
2 parents 8c601ed + ebd1a0a commit 6d1a2b3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4770,9 +4770,11 @@ ZEND_API int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op,
47704770
if (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) {
47714771
/* Destructor may throw. */
47724772
return 1;
4773+
} else {
4774+
zval *value = (zval*)((char*)op_array->static_variables + (opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT|ZEND_BIND_EXPLICIT)));
4775+
/* May throw if initializer is CONSTANT_AST. */
4776+
return Z_TYPE_P(value) == IS_CONSTANT_AST;
47734777
}
4774-
/* TODO: May not throw if initializer is not CONSTANT_AST. */
4775-
return 1;
47764778
case ZEND_ASSIGN_DIM:
47774779
if ((opline+1)->op1_type == IS_CV) {
47784780
if (_ssa_op1_info(op_array, ssa, opline+1, ssa_op+1) & MAY_BE_UNDEF) {

0 commit comments

Comments
 (0)