Skip to content

Commit 486fefb

Browse files
committed
Fix may_throw for ASSIGN_OP
1 parent b2a0b80 commit 486fefb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4423,26 +4423,26 @@ int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_
44234423
&& (t2 & MAY_BE_ANY) == MAY_BE_ARRAY) {
44244424
return 0;
44254425
}
4426-
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT)) ||
4427-
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT));
4426+
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4427+
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
44284428
} else if (opline->extended_value == ZEND_DIV ||
44294429
opline->extended_value == ZEND_MOD) {
44304430
if (!OP2_HAS_RANGE() ||
44314431
(OP2_MIN_RANGE() <= 0 && OP2_MAX_RANGE() >= 0)) {
44324432
/* Division by zero */
44334433
return 1;
44344434
}
4435-
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT)) ||
4436-
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT));
4435+
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4436+
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
44374437
} else if (opline->extended_value == ZEND_SUB ||
44384438
opline->extended_value == ZEND_MUL ||
44394439
opline->extended_value == ZEND_POW) {
4440-
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT)) ||
4441-
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT));
4440+
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4441+
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
44424442
} else if (opline->extended_value == ZEND_SL ||
44434443
opline->extended_value == ZEND_SR) {
4444-
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT)) ||
4445-
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT)) ||
4444+
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4445+
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
44464446
!OP2_HAS_RANGE() ||
44474447
OP2_MIN_RANGE() < 0;
44484448
} else if (opline->extended_value == ZEND_CONCAT) {
@@ -4455,8 +4455,8 @@ int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_
44554455
&& (t2 & MAY_BE_ANY) == MAY_BE_STRING) {
44564456
return 0;
44574457
}
4458-
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT)) ||
4459-
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT));
4458+
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4459+
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
44604460
}
44614461
return 1;
44624462
case ZEND_ASSIGN:

0 commit comments

Comments
 (0)