Skip to content

Commit 7b3b362

Browse files
committed
Non-JIT passes a pointer to a temp zval into zend_observer_fcall_end
Add internal variables to test output check
1 parent c8201ed commit 7b3b362

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10942,6 +10942,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
1094210942
if (Z_REFCOUNTED_P(zv)) {
1094310943
| ADDREF_CONST zv, REG0, TMP1
1094410944
}
10945+
op1_addr = ret_addr;
1094510946
} else if (opline->op1_type == IS_TMP_VAR) {
1094610947
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_REG0, ZREG_REG2, ZREG_TMP1, ZREG_TMP2, ZREG_FPR0
1094710948
} else if (opline->op1_type == IS_CV) {
@@ -11001,7 +11002,6 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
1100111002
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_REG0, ZREG_REG2, ZREG_TMP1, ZREG_TMP2, ZREG_FPR0
1100211003
}
1100311004
}
11004-
1100511005
|9:
1100611006
if (ZEND_OBSERVER_ENABLED) {
1100711007
if (Z_MODE(op1_addr) == IS_REG) {

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11655,6 +11655,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
1165511655
if (Z_REFCOUNTED_P(zv)) {
1165611656
| ADDREF_CONST zv, r0
1165711657
}
11658+
op1_addr = ret_addr;
1165811659
} else if (opline->op1_type == IS_TMP_VAR) {
1165911660
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
1166011661
} else if (opline->op1_type == IS_CV) {

ext/zend_test/tests/observer_retval_alter_01.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function hook(): string {
1919
return 'hook value';
2020
}
2121

22-
$res = foo('some value'); // Retval used
22+
$res = foo('some value');
2323
var_dump($res);
2424
echo 'Done' . PHP_EOL;
2525
?>
@@ -28,6 +28,7 @@ echo 'Done' . PHP_EOL;
2828
<!-- init foo() -->
2929
<foo>
3030
<!-- init hook() -->
31-
</foo:'original return value'>
31+
</foo:'hook value'>
32+
<!-- init var_dump() -->
3233
string(10) "hook value"
3334
Done

0 commit comments

Comments
 (0)