From 299727ae11998fdcd9d7692a0443099c671cd288 Mon Sep 17 00:00:00 2001 From: longxinhui Date: Mon, 5 Jul 2021 00:52:17 +0800 Subject: [PATCH] fix issue60 fix issue60 #60 --- extension/xhprof.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/extension/xhprof.c b/extension/xhprof.c index 522b0116..8a043fe5 100755 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -999,18 +999,10 @@ void hp_mode_sampled_endfn_cb(hp_entry_t **entries) #if PHP_VERSION_ID >= 80000 static void tracer_observer_begin(zend_execute_data *execute_data) { - if (!XHPROF_G(enabled)) { - return; - } - begin_profiling(NULL, execute_data); } static void tracer_observer_end(zend_execute_data *ex, zval *return_value) { - if (!XHPROF_G(enabled)) { - return; - } - if (XHPROF_G(entries)) { end_profiling(); } @@ -1018,6 +1010,10 @@ static void tracer_observer_end(zend_execute_data *ex, zval *return_value) { static zend_observer_fcall_handlers tracer_observer(zend_execute_data *execute_data) { + if (!XHPROF_G(enabled)) { + return (zend_observer_fcall_handlers){NULL, NULL}; + } + zend_function *func = execute_data->func; if (!func->common.function_name) {