Skip to content

Commit 8d4bf5e

Browse files
committed
fix return value stuff
1 parent 5979501 commit 8d4bf5e

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

agent/fw_wordpress.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ NR_PHP_WRAPPER(nr_wordpress_wrap_hook_core) {
346346
NR_PHP_WRAPPER_LEAVE;
347347
}
348348

349-
NR_PHP_WRAPPER_CALL;
350349
if (NRPRG(wordpress_core)) {
351350
nr_wordpress_create_metric(auto_segment, NR_WORDPRESS_HOOK_PREFIX, tag);
352351
}
@@ -374,7 +373,6 @@ NR_PHP_WRAPPER(nr_wordpress_wrap_hook_plugin) {
374373
plugin = wraprec->wordpress_plugin_theme;
375374
//plugin = nr_wordpress_plugin_from_function(execute_data->func);
376375

377-
NR_PHP_WRAPPER_CALL;
378376
if (NULL != plugin) {
379377
nr_wordpress_create_metric(auto_segment, NR_WORDPRESS_HOOK_PREFIX, tag);
380378
nr_wordpress_create_metric(auto_segment, NR_WORDPRESS_PLUGIN_PREFIX,

agent/php_execute.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO, bool create_metric, boo
21342134
"Uncaught exception ", &NRPRG(exception_filters) TSRMLS_CC);
21352135
} else if (NULL == nr_php_get_return_value(NR_EXECUTE_ORIG_ARGS)) {
21362136
#else
2137-
if (NULL == nr_php_get_return_value(NR_EXECUTE_ORIG_ARGS)) {
2137+
if (NULL == func_return_value) {
21382138
#endif
21392139
/*
21402140
* Having no return value (and not being an exception handler) indicates
@@ -2146,6 +2146,9 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO, bool create_metric, boo
21462146
nr_status_t status = nr_php_error_record_exception_segment(
21472147
NRPRG(txn), &exception,
21482148
&NRPRG(exception_filters));
2149+
if (execute_data->func && execute_data->func->common.function_name) {
2150+
nrl_verbosedebug(NRL_AGENT, "END %s", ZSTR_VAL(execute_data->func->common.function_name));
2151+
}
21492152

21502153
if (NR_FAILURE == status) {
21512154
nrl_verbosedebug(NRL_AGENT, "%s: unable to record exception on segment",
@@ -2230,6 +2233,9 @@ void nr_php_observer_fcall_begin(zend_execute_data* execute_data) {
22302233
//if (execute_data->func && execute_data->func->common.function_name) {
22312234
// printf("BEGIN %s\n", ZSTR_VAL(execute_data->func->common.function_name));
22322235
//}
2236+
if (execute_data->func && execute_data->func->common.function_name) {
2237+
nrl_verbosedebug(NRL_AGENT, "BEGIN %s", ZSTR_VAL(execute_data->func->common.function_name));
2238+
}
22332239
if (nrunlikely(NULL == execute_data)) {
22342240
return;
22352241
}
@@ -2272,7 +2278,7 @@ void nr_php_observer_fcall_begin_instrumented(zend_execute_data* execute_data) {
22722278
*/
22732279
zval* func_return_value = NULL;
22742280
//if (execute_data->func && execute_data->func->common.function_name) {
2275-
// printf("BEGIN %s\n", ZSTR_VAL(execute_data->func->common.function_name));
2281+
// nrl_verbosedebug(NRL_AGENT, "BEGIN %s", ZSTR_VAL(execute_data->func->common.function_name));
22762282
//}
22772283
if (nrunlikely(NULL == execute_data)) {
22782284
return;

agent/php_wrapper.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ extern zval** nr_php_get_return_value_ptr(TSRMLS_D);
273273
bool is_begin = false; \
274274
nruserfn_t* wraprec = NULL; \
275275
zval* func_return_value = NULL; \
276-
zval** func_return_value_ptr = NULL; \
277276
const nrtxn_t* txn = NRPRG(txn); \
278277
const nrtime_t txn_start_time = nr_txn_start_time(txn); \
279278
if (NRPRG(in_wrapper)) { \
@@ -288,10 +287,11 @@ extern zval** nr_php_get_return_value_ptr(TSRMLS_D);
288287
auto_segment = nr_txn_get_current_segment(NRPRG(txn), NULL); \
289288
is_begin = true; \
290289
} else { \
291-
func_return_value_ptr = nr_php_get_return_value_ptr(); \
292-
func_return_value = func_return_value_ptr ? *func_return_value_ptr : NULL;\
290+
va_list ptr; \
291+
va_start(ptr, execute_data); \
292+
func_return_value = va_arg(ptr, zval*); \
293293
nr_php_observer_fcall_end_keep_segment(execute_data, \
294-
func_return_value_ptr ? *func_return_value_ptr : NULL); \
294+
func_return_value); \
295295
}
296296
#endif
297297

0 commit comments

Comments
 (0)