Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed ability to call user functions from user opcodes without recursion

  • Loading branch information...
commit f1ab855cfe9bc4a688014d2bdca326777ba7ef02 1 parent a515259
Dmitry Stogov authored
View
2  Zend/zend_execute.h
@@ -351,6 +351,8 @@ ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execut
#define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */
#define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */
#define ZEND_USER_OPCODE_DISPATCH 2 /* call original opcode handler */
+#define ZEND_USER_OPCODE_ENTER 3 /* enter into new op_array without recursion */
+#define ZEND_USER_OPCODE_LEAVE 4 /* return to calling op_array within the same executor */
#define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
View
8 Zend/zend_vm_def.h
@@ -2328,16 +2328,12 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
}
-#ifndef ZEND_VM_EXPORT
if (zend_execute == execute && !EG(exception)) {
EX(call_opline) = opline;
ZEND_VM_ENTER();
} else {
zend_execute(EG(active_op_array) TSRMLS_CC);
}
-#else
- zend_execute(EG(active_op_array) TSRMLS_CC);
-#endif
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
@@ -4358,6 +4354,10 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
ZEND_VM_CONTINUE();
case ZEND_USER_OPCODE_RETURN:
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ case ZEND_USER_OPCODE_ENTER:
+ ZEND_VM_ENTER();
+ case ZEND_USER_OPCODE_LEAVE:
+ ZEND_VM_LEAVE();
case ZEND_USER_OPCODE_DISPATCH:
ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline));
default:
View
8 Zend/zend_vm_execute.h
@@ -330,16 +330,12 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
}
-#if 1
if (zend_execute == execute && !EG(exception)) {
EX(call_opline) = opline;
ZEND_VM_ENTER();
} else {
zend_execute(EG(active_op_array) TSRMLS_CC);
}
-#else
- zend_execute(EG(active_op_array) TSRMLS_CC);
-#endif
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
@@ -699,6 +695,10 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZEND_VM_CONTINUE();
case ZEND_USER_OPCODE_RETURN:
return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ case ZEND_USER_OPCODE_ENTER:
+ ZEND_VM_ENTER();
+ case ZEND_USER_OPCODE_LEAVE:
+ ZEND_VM_LEAVE();
case ZEND_USER_OPCODE_DISPATCH:
ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline));
default:
Please sign in to comment.
Something went wrong with that request. Please try again.