@@ -2077,7 +2077,7 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO) {
2077
2077
bool create_metric = false;
2078
2078
nr_php_execute_metadata_t metadata = {0 };
2079
2079
#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 ) {
2081
2081
#endif
2082
2082
nr_segment_t * segment = NULL ;
2083
2083
nrtime_t txn_start_time = 0 ;
@@ -2116,8 +2116,10 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO, bool create_metric, boo
2116
2116
2117
2117
#if ZEND_MODULE_API_NO < ZEND_8_2_X_API_NO
2118
2118
wraprec = segment -> wraprec ;
2119
-
2120
2119
if (segment -> is_exception_handler ) {
2120
+ #else
2121
+ if (is_exception_handler ) {
2122
+ #endif
2121
2123
/*
2122
2124
* After running the exception handler segment, create an error from
2123
2125
* 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
2131
2133
nr_php_error_record_exception (
2132
2134
NRPRG (txn ), exception , nr_php_error_get_priority (E_ERROR ), false,
2133
2135
"Uncaught exception " , & NRPRG (exception_filters ) TSRMLS_CC );
2136
+ #if ZEND_MODULE_API_NO < ZEND_8_2_X_API_NO
2134
2137
} else if (NULL == nr_php_get_return_value (NR_EXECUTE_ORIG_ARGS )) {
2135
2138
#else
2136
- if (NULL == func_return_value ) {
2139
+ } else if (NULL == func_return_value ) {
2137
2140
#endif
2138
2141
/*
2139
2142
* 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) {
2273
2276
static void nr_php_observer_fcall_end_common (zend_execute_data * execute_data ,
2274
2277
zval * func_return_value ,
2275
2278
bool create_metric ,
2276
- bool end_segment ) {
2279
+ bool end_segment ,
2280
+ bool is_exception_handler ) {
2277
2281
#else
2278
2282
void nr_php_observer_fcall_end (zend_execute_data * execute_data ,
2279
2283
zval * func_return_value ) {
@@ -2304,7 +2308,7 @@ void nr_php_observer_fcall_end(zend_execute_data* execute_data,
2304
2308
}
2305
2309
2306
2310
#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 );
2308
2312
#else
2309
2313
nr_php_instrument_func_end (NR_EXECUTE_ORIG_ARGS );
2310
2314
#endif
@@ -2324,15 +2328,19 @@ void nr_php_observer_fcall_begin_instrumented(zend_execute_data* execute_data) {
2324
2328
}
2325
2329
void nr_php_observer_fcall_end (zend_execute_data * execute_data ,
2326
2330
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 );
2328
2332
}
2329
2333
void nr_php_observer_fcall_end_create_metric (zend_execute_data * execute_data ,
2330
2334
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 );
2332
2336
}
2333
2337
void nr_php_observer_fcall_end_keep_segment (zend_execute_data * execute_data ,
2334
2338
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);
2336
2344
}
2337
2345
2338
2346
// These empty functions (rather than NULL) are used to know if instrumentation
0 commit comments