diff --git a/src/ext/dispatch.c b/src/ext/dispatch.c index 903825c36ec..60c0c3b518d 100644 --- a/src/ext/dispatch.c +++ b/src/ext/dispatch.c @@ -115,9 +115,6 @@ static void execute_fcall(ddtrace_dispatch_t *dispatch, zend_execute_data *execu if (!return_value_ptr) { zval_dtor(&rv); } - #if PHP_VERSION_ID < 70000 - zend_vm_stack_clear_multiple(0 TSRMLS_CC); - #endif } #if PHP_VERSION_ID < 70000 @@ -275,9 +272,8 @@ static zend_always_inline zend_bool get_wrappable_function(zend_execute_data *ex static int update_opcode_leave(zend_execute_data *execute_data) { #if PHP_VERSION_ID < 70000 - if (EG(exception)) { - zend_vm_stack_pop(); // clear param data if FN has thrown an exception - } + zend_vm_stack_clear_multiple(0 TSRMLS_CC); + EX(call)--; #else EX(call) = EX(call)->prev_execute_data; #endif diff --git a/src/ext/dispatch_compat_php5.c b/src/ext/dispatch_compat_php5.c index 360b0391f7d..86b93a31dcd 100644 --- a/src/ext/dispatch_compat_php5.c +++ b/src/ext/dispatch_compat_php5.c @@ -51,7 +51,9 @@ static zend_always_inline void setup_fcal_name(zend_execute_data *execute_data, if (EX(call)->num_additional_args) { vm_stack_push_args(fci->param_count TSRMLS_CC); } else { - EX(function_state).arguments = zend_vm_stack_top(TSRMLS_C); + if (fci->param_count) { + EX(function_state).arguments = zend_vm_stack_top(TSRMLS_C); + } zend_vm_stack_push((void *)(zend_uintptr_t)fci->param_count TSRMLS_CC); }