Skip to content

Commit a3f5b11

Browse files
committed
Sync JIT overloaded assign/inc/dec overloaded property
We should only release the read_property return value if retval is used, same as in zend_execute.c. This fixes a test failure under PROFITABILITY_CHECKS=0.
1 parent a190c7f commit a3f5b11

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,9 @@ static zend_never_inline void _zend_jit_assign_op_overloaded_property(zend_objec
20512051
//??? if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
20522052
//??? ZVAL_COPY(EX_VAR(opline->result.var), &res);
20532053
//??? }
2054-
zval_ptr_dtor(z);
2054+
if (z == &rv) {
2055+
zval_ptr_dtor(z);
2056+
}
20552057
zval_ptr_dtor(&res);
20562058
OBJ_RELEASE(object);
20572059
}
@@ -2361,7 +2363,9 @@ static void ZEND_FASTCALL zend_jit_pre_inc_obj_helper(zend_object *zobj, zend_st
23612363
zobj->handlers->write_property(zobj, name, &z_copy, cache_slot);
23622364
OBJ_RELEASE(zobj);
23632365
zval_ptr_dtor(&z_copy);
2364-
zval_ptr_dtor(z);
2366+
if (z == &rv) {
2367+
zval_ptr_dtor(z);
2368+
}
23652369
}
23662370
}
23672371

@@ -2430,7 +2434,9 @@ static void ZEND_FASTCALL zend_jit_pre_dec_obj_helper(zend_object *zobj, zend_st
24302434
zobj->handlers->write_property(zobj, name, &z_copy, cache_slot);
24312435
OBJ_RELEASE(zobj);
24322436
zval_ptr_dtor(&z_copy);
2433-
zval_ptr_dtor(z);
2437+
if (z == &rv) {
2438+
zval_ptr_dtor(z);
2439+
}
24342440
}
24352441
}
24362442

@@ -2489,7 +2495,9 @@ static void ZEND_FASTCALL zend_jit_post_inc_obj_helper(zend_object *zobj, zend_s
24892495
zobj->handlers->write_property(zobj, name, &z_copy, cache_slot);
24902496
OBJ_RELEASE(zobj);
24912497
zval_ptr_dtor(&z_copy);
2492-
zval_ptr_dtor(z);
2498+
if (z == &rv) {
2499+
zval_ptr_dtor(z);
2500+
}
24932501
}
24942502
}
24952503

@@ -2548,7 +2556,9 @@ static void ZEND_FASTCALL zend_jit_post_dec_obj_helper(zend_object *zobj, zend_s
25482556
zobj->handlers->write_property(zobj, name, &z_copy, cache_slot);
25492557
OBJ_RELEASE(zobj);
25502558
zval_ptr_dtor(&z_copy);
2551-
zval_ptr_dtor(z);
2559+
if (z == &rv) {
2560+
zval_ptr_dtor(z);
2561+
}
25522562
}
25532563
}
25542564

0 commit comments

Comments
 (0)