diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index 1ccfef1939c23..fb60bc5e215b4 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -10942,6 +10942,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o if (Z_REFCOUNTED_P(zv)) { | ADDREF_CONST zv, REG0, TMP1 } + op1_addr = ret_addr; } else if (opline->op1_type == IS_TMP_VAR) { | ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_REG0, ZREG_REG2, ZREG_TMP1, ZREG_TMP2, ZREG_FPR0 } 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 | ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_REG0, ZREG_REG2, ZREG_TMP1, ZREG_TMP2, ZREG_FPR0 } } - |9: if (ZEND_OBSERVER_ENABLED) { if (Z_MODE(op1_addr) == IS_REG) { diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index a5890b7852cbf..7f40ab7cecb69 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -11655,6 +11655,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o if (Z_REFCOUNTED_P(zv)) { | ADDREF_CONST zv, r0 } + op1_addr = ret_addr; } else if (opline->op1_type == IS_TMP_VAR) { | ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2 } else if (opline->op1_type == IS_CV) { diff --git a/ext/zend_test/tests/observer_retval_alter_01.phpt b/ext/zend_test/tests/observer_retval_alter_01.phpt index 2b32c9192d908..b9787a481bec8 100644 --- a/ext/zend_test/tests/observer_retval_alter_01.phpt +++ b/ext/zend_test/tests/observer_retval_alter_01.phpt @@ -19,7 +19,7 @@ function hook(): string { return 'hook value'; } -$res = foo('some value'); // Retval used +$res = foo('some value'); var_dump($res); echo 'Done' . PHP_EOL; ?> @@ -28,6 +28,7 @@ echo 'Done' . PHP_EOL; - + + string(10) "hook value" Done