Skip to content

Commit b5b44f9

Browse files
committed
Fix updating SSA object type for *_ASSIGN_OP
The code fetched the class entry into ce for objects and static properties. However, when the actual update needs to take place (when result_def exists), the class entry in ce was reset to NULL. So the SSA object type update never happened. Fetch the class entry in the result_def>=0 case instead after the reset of ce to NULL.
1 parent f7e6784 commit b5b44f9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,7 +2464,7 @@ static zend_always_inline int _zend_update_type_info(
24642464
if (opline->opcode == ZEND_ASSIGN_OBJ_OP) {
24652465
prop_info = zend_fetch_prop_info(op_array, ssa, opline, ssa_op);
24662466
orig = t1;
2467-
t1 = zend_fetch_prop_type(script, prop_info, &ce);
2467+
t1 = zend_fetch_prop_type(script, prop_info, NULL);
24682468
t2 = OP1_DATA_INFO();
24692469
} else if (opline->opcode == ZEND_ASSIGN_DIM_OP) {
24702470
if (t1 & MAY_BE_ARRAY_OF_REF) {
@@ -2475,7 +2475,7 @@ static zend_always_inline int _zend_update_type_info(
24752475
t2 = OP1_DATA_INFO();
24762476
} else if (opline->opcode == ZEND_ASSIGN_STATIC_PROP_OP) {
24772477
prop_info = zend_fetch_static_prop_info(script, op_array, ssa, opline);
2478-
t1 = zend_fetch_prop_type(script, prop_info, &ce);
2478+
t1 = zend_fetch_prop_type(script, prop_info, NULL);
24792479
t2 = OP1_DATA_INFO();
24802480
} else {
24812481
if (t1 & MAY_BE_REF) {
@@ -2537,7 +2537,7 @@ static zend_always_inline int _zend_update_type_info(
25372537
} else if (opline->opcode == ZEND_ASSIGN_OBJ_OP) {
25382538
/* The return value must also satisfy the property type */
25392539
if (prop_info) {
2540-
t1 = zend_fetch_prop_type(script, prop_info, NULL);
2540+
t1 = zend_fetch_prop_type(script, prop_info, &ce);
25412541
if ((t1 & (MAY_BE_LONG|MAY_BE_DOUBLE)) == MAY_BE_LONG
25422542
&& (tmp & (MAY_BE_LONG|MAY_BE_DOUBLE)) == MAY_BE_DOUBLE) {
25432543
/* DOUBLE may be auto-converted to LONG */
@@ -2549,7 +2549,7 @@ static zend_always_inline int _zend_update_type_info(
25492549
} else if (opline->opcode == ZEND_ASSIGN_STATIC_PROP_OP) {
25502550
/* The return value must also satisfy the property type */
25512551
if (prop_info) {
2552-
t1 = zend_fetch_prop_type(script, prop_info, NULL);
2552+
t1 = zend_fetch_prop_type(script, prop_info, &ce);
25532553
if ((t1 & (MAY_BE_LONG|MAY_BE_DOUBLE)) == MAY_BE_LONG
25542554
&& (tmp & (MAY_BE_LONG|MAY_BE_DOUBLE)) == MAY_BE_DOUBLE) {
25552555
/* DOUBLE may be auto-converted to LONG */

0 commit comments

Comments
 (0)