Skip to content

Commit 79e6dba

Browse files
committed
Preserve return value in zend_vm_call_opcode_handler with global opline/ex registers enabled
1 parent a49ce7b commit 79e6dba

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Zend/zend_vm_execute.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49565,7 +49565,10 @@ ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)
4956549565
LOAD_OPLINE();
4956649566
#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)
4956749567
((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
49568-
ret = (opline) ? 0 : -1;
49568+
ret = (opline) ? execute_data != ex : -1;
49569+
if (ret == 1 && execute_data->prev_execute_data != ex) {
49570+
ret = 2;;
49571+
}
4956949572
#else
4957049573
ret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4957149574
#endif

Zend/zend_vm_gen.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,10 @@ function gen_vm($def, $skel) {
16061606
out($f, "\tLOAD_OPLINE();\n");
16071607
out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
16081608
out($f, "\t((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1609-
out($f, "\tret = (opline) ? 0 : -1;\n");
1609+
out($f, "\tret = (opline) ? execute_data != ex : -1;\n");
1610+
out($f, "\tif (ret == 1 && execute_data->prev_execute_data != ex) {\n");
1611+
out($f, "\t\tret = 2;;\n");
1612+
out($f, "\t}\n");
16101613
out($f, "#else\n");
16111614
out($f, "\tret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
16121615
out($f, "#endif\n");

0 commit comments

Comments
 (0)