@@ -2077,7 +2077,7 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO) {
20772077 bool create_metric = false;
20782078 nr_php_execute_metadata_t metadata = {0 };
20792079#else
2080- static void nr_php_instrument_func_end (NR_EXECUTE_PROTO , bool create_metric , bool end_segment ) {
2080+ static void nr_php_instrument_func_end (NR_EXECUTE_PROTO , bool create_metric , bool end_segment , bool is_exception_handler ) {
20812081#endif
20822082 nr_segment_t * segment = NULL ;
20832083 nrtime_t txn_start_time = 0 ;
@@ -2116,8 +2116,10 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO, bool create_metric, boo
21162116
21172117#if ZEND_MODULE_API_NO < ZEND_8_2_X_API_NO
21182118 wraprec = segment -> wraprec ;
2119-
21202119 if (segment -> is_exception_handler ) {
2120+ #else
2121+ if (is_exception_handler ) {
2122+ #endif
21212123 /*
21222124 * After running the exception handler segment, create an error from
21232125 * the exception it handled, and save the error in the transaction.
@@ -2131,9 +2133,10 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO, bool create_metric, boo
21312133 nr_php_error_record_exception (
21322134 NRPRG (txn ), exception , nr_php_error_get_priority (E_ERROR ), false,
21332135 "Uncaught exception " , & NRPRG (exception_filters ) TSRMLS_CC );
2136+ #if ZEND_MODULE_API_NO < ZEND_8_2_X_API_NO
21342137 } else if (NULL == nr_php_get_return_value (NR_EXECUTE_ORIG_ARGS )) {
21352138#else
2136- if (NULL == func_return_value ) {
2139+ } else if (NULL == func_return_value ) {
21372140#endif
21382141 /*
21392142 * Having no return value (and not being an exception handler) indicates
@@ -2273,7 +2276,8 @@ void nr_php_observer_fcall_begin(zend_execute_data* execute_data) {
22732276static void nr_php_observer_fcall_end_common (zend_execute_data * execute_data ,
22742277 zval * func_return_value ,
22752278 bool create_metric ,
2276- bool end_segment ) {
2279+ bool end_segment ,
2280+ bool is_exception_handler ) {
22772281#else
22782282void nr_php_observer_fcall_end (zend_execute_data * execute_data ,
22792283 zval * func_return_value ) {
@@ -2304,7 +2308,7 @@ void nr_php_observer_fcall_end(zend_execute_data* execute_data,
23042308 }
23052309
23062310#if ZEND_MODULE_API_NO >= ZEND_8_2_X_API_NO
2307- nr_php_instrument_func_end (NR_EXECUTE_ORIG_ARGS , create_metric , end_segment );
2311+ nr_php_instrument_func_end (NR_EXECUTE_ORIG_ARGS , create_metric , end_segment , is_exception_handler );
23082312#else
23092313 nr_php_instrument_func_end (NR_EXECUTE_ORIG_ARGS );
23102314#endif
@@ -2324,15 +2328,19 @@ void nr_php_observer_fcall_begin_instrumented(zend_execute_data* execute_data) {
23242328}
23252329void nr_php_observer_fcall_end (zend_execute_data * execute_data ,
23262330 zval * func_return_value ) {
2327- nr_php_observer_fcall_end_common (execute_data , func_return_value , false, true);
2331+ nr_php_observer_fcall_end_common (execute_data , func_return_value , false, true, false );
23282332}
23292333void nr_php_observer_fcall_end_create_metric (zend_execute_data * execute_data ,
23302334 zval * func_return_value ) {
2331- nr_php_observer_fcall_end_common (execute_data , func_return_value , true, true);
2335+ nr_php_observer_fcall_end_common (execute_data , func_return_value , true, true, false );
23322336}
23332337void nr_php_observer_fcall_end_keep_segment (zend_execute_data * execute_data ,
23342338 zval * func_return_value ) {
2335- nr_php_observer_fcall_end_common (execute_data , func_return_value , false, false);
2339+ nr_php_observer_fcall_end_common (execute_data , func_return_value , false, false, false);
2340+ }
2341+ void nr_php_observer_fcall_end_exception_handler (zend_execute_data * execute_data ,
2342+ zval * func_return_value ) {
2343+ nr_php_observer_fcall_end_common (execute_data , func_return_value , false, true, true);
23362344}
23372345
23382346// These empty functions (rather than NULL) are used to know if instrumentation
0 commit comments