9595
9696static void nr_php_show_exec_return (NR_EXECUTE_PROTO TSRMLS_DC );
9797static int nr_php_show_exec_indentation (TSRMLS_D );
98- static void nr_php_show_exec (NR_EXECUTE_PROTO TSRMLS_DC );
9998
10099/*
101100 * Purpose: Enable monitoring on specific functions in the framework.
@@ -594,11 +593,11 @@ static int nr_php_show_exec_indentation(TSRMLS_D) {
594593 * Note that this function doesn't handle internal functions, and will crash if
595594 * you give it one.
596595 */
597- static void nr_php_show_exec (NR_EXECUTE_PROTO TSRMLS_DC ) {
596+ void nr_php_show_exec (const char * context , NR_EXECUTE_PROTO TSRMLS_DC ) {
598597 char argstr [NR_EXECUTE_DEBUG_STRBUFSZ ];
599598 const char * filename = nr_php_op_array_file_name (NR_OP_ARRAY );
600599 const char * function_name = nr_php_op_array_function_name (NR_OP_ARRAY );
601-
600+ const char * ctx = context ? context : "execute" ;
602601 argstr [0 ] = '\0' ;
603602
604603 if (NR_OP_ARRAY -> scope ) {
@@ -608,12 +607,13 @@ static void nr_php_show_exec(NR_EXECUTE_PROTO TSRMLS_DC) {
608607 nr_show_execute_params (NR_EXECUTE_ORIG_ARGS , argstr TSRMLS_CC );
609608 nrl_verbosedebug (
610609 NRL_AGENT ,
611- "execute : %.*s scope={%.*s} function={" NRP_FMT_UQ
610+ NRP_FMT_UQ " : %.*s scope={%.*s} function={" NRP_FMT_UQ
612611 "}"
613612 " params={" NRP_FMT_UQ
614613 "}"
615614 " %.5s"
616615 "@ " NRP_FMT_UQ ":%d" ,
616+ NRP_SHOW_EXEC_CONTEXT (ctx ),
617617 nr_php_show_exec_indentation (TSRMLS_C ), nr_php_indentation_spaces ,
618618 NRSAFELEN (nr_php_class_entry_name_length (NR_OP_ARRAY -> scope )),
619619 nr_php_class_entry_name (NR_OP_ARRAY -> scope ),
@@ -631,12 +631,13 @@ static void nr_php_show_exec(NR_EXECUTE_PROTO TSRMLS_DC) {
631631 nr_show_execute_params (NR_EXECUTE_ORIG_ARGS , argstr TSRMLS_CC );
632632 nrl_verbosedebug (
633633 NRL_AGENT ,
634- "execute : %.*s function={" NRP_FMT_UQ
634+ NRP_FMT_UQ " : %.*s function={" NRP_FMT_UQ
635635 "}"
636636 " params={" NRP_FMT_UQ
637637 "}"
638638 " %.5s"
639639 "@ " NRP_FMT_UQ ":%d" ,
640+ NRP_SHOW_EXEC_CONTEXT (ctx ),
640641 nr_php_show_exec_indentation (TSRMLS_C ), nr_php_indentation_spaces ,
641642 NRP_PHP (function_name ), NRP_ARGSTR (argstr ),
642643#if ZEND_MODULE_API_NO < ZEND_7_4_X_API_NO
@@ -649,16 +650,17 @@ static void nr_php_show_exec(NR_EXECUTE_PROTO TSRMLS_DC) {
649650 /*
650651 * file
651652 */
652- nrl_verbosedebug (NRL_AGENT , "execute: %.*s file={" NRP_FMT "}" ,
653+ nrl_verbosedebug (NRL_AGENT , NRP_FMT_UQ ": %.*s file={" NRP_FMT "}" ,
654+ NRP_SHOW_EXEC_CONTEXT (ctx ),
653655 nr_php_show_exec_indentation (TSRMLS_C ),
654656 nr_php_indentation_spaces , NRP_FILENAME (filename ));
655657 } else {
656658 /*
657659 * unknown
658660 */
659- nrl_verbosedebug (NRL_AGENT , "execute : %.*s ?" ,
660- nr_php_show_exec_indentation ( TSRMLS_C ),
661- nr_php_indentation_spaces );
661+ nrl_verbosedebug (NRL_AGENT , NRP_FMT_UQ " : %.*s ?" ,
662+ NRP_SHOW_EXEC_CONTEXT ( ctx ),
663+ nr_php_show_exec_indentation ( TSRMLS_C ), nr_php_indentation_spaces );
662664 }
663665}
664666
@@ -982,7 +984,7 @@ static void nr_php_user_instrumentation_from_file(const char* filename,
982984 */
983985#define METRIC_NAME_MAX_LEN 512
984986
985- static void nr_php_execute_file (const zend_op_array * op_array ,
987+ void nr_php_execute_file (const zend_op_array * op_array ,
986988 NR_EXECUTE_PROTO TSRMLS_DC ) {
987989 const char * filename = nr_php_op_array_file_name (op_array );
988990 size_t filename_len = nr_php_op_array_file_name_len (op_array );
@@ -1007,7 +1009,9 @@ static void nr_php_execute_file(const zend_op_array* op_array,
10071009 return ;
10081010 }
10091011
1012+ #if ZEND_MODULE_API_NO < ZEND_8_0_X_API_NO
10101013 nr_php_add_user_instrumentation (TSRMLS_C );
1014+ #endif
10111015}
10121016
10131017/*
@@ -1519,7 +1523,7 @@ static void nr_php_execute_enabled(NR_EXECUTE_PROTO TSRMLS_DC) {
15191523
15201524static void nr_php_execute_show (NR_EXECUTE_PROTO TSRMLS_DC ) {
15211525 if (nrunlikely (NR_PHP_PROCESS_GLOBALS (special_flags ).show_executes )) {
1522- nr_php_show_exec (NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
1526+ nr_php_show_exec ("execute" , NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
15231527 }
15241528
15251529 nr_php_execute_enabled (NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
@@ -1905,16 +1909,7 @@ static void nr_php_instrument_func_begin(NR_EXECUTE_PROTO) {
19051909
19061910 NRTXNGLOBAL (execute_count ) += 1 ;
19071911 txn_start_time = nr_txn_start_time (NRPRG (txn ));
1908- /*
1909- * Handle here, but be aware the classes might not be loaded yet.
1910- */
1911- if (nrunlikely (OP_ARRAY_IS_A_FILE (NR_OP_ARRAY ))) {
1912- const char * filename = nr_php_op_array_file_name (NR_OP_ARRAY );
1913- size_t filename_len = nr_php_op_array_file_name_len (NR_OP_ARRAY );
1914- nr_execute_handle_framework (all_frameworks , num_all_frameworks ,
1915- filename , filename_len TSRMLS_CC );
1916- return ;
1917- }
1912+
19181913 if (NULL != NRPRG (cufa_callback ) && NRPRG (check_cufa )) {
19191914 /*
19201915 * For PHP 7+, call_user_func_array() is flattened into an inline by
@@ -2000,14 +1995,6 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO) {
20001995 }
20011996 txn_start_time = nr_txn_start_time (NRPRG (txn ));
20021997
2003- /*
2004- * Let's get the framework info.
2005- */
2006- if (nrunlikely (OP_ARRAY_IS_A_FILE (NR_OP_ARRAY ))) {
2007- nr_php_execute_file (NR_OP_ARRAY , NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
2008- return ;
2009- }
2010-
20111998 /*
20121999 * Get the current segment and return if null.
20132000 */
@@ -2157,7 +2144,7 @@ void nr_php_observer_fcall_begin(zend_execute_data* execute_data) {
21572144 int show_executes = NR_PHP_PROCESS_GLOBALS (special_flags ).show_executes ;
21582145
21592146 if (nrunlikely (show_executes )) {
2160- nr_php_show_exec (NR_EXECUTE_ORIG_ARGS );
2147+ nr_php_show_exec ("execute" , NR_EXECUTE_ORIG_ARGS );
21612148 }
21622149 nr_php_instrument_func_begin (NR_EXECUTE_ORIG_ARGS );
21632150
0 commit comments