Skip to content

Commit cb19ba7

Browse files
committed
remove ErrorHandler wrapper for PHPs 8.0+
Agent for PHPs 8.0+ uses observer API to hook into Zend Engine, which allows offers better out-of-the-box instrumentation of user exception handler. When observer API is used, there's no need to wrap exception handlers to record errors.
1 parent 8e5cd7c commit cb19ba7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

agent/fw_yii.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ NR_PHP_WRAPPER(nr_yii2_runWithParams_wrapper) {
152152
}
153153
NR_PHP_WRAPPER_END
154154

155+
#if ZEND_MODULE_API_NO < ZEND_8_0_X_API_NO \
156+
|| defined OVERWRITE_ZEND_EXECUTE_DATA
155157
/*
156158
* Yii2: Report errors and exceptions when built-in ErrorHandler is enabled.
157159
*/
@@ -184,6 +186,7 @@ NR_PHP_WRAPPER(nr_yii2_error_handler_wrapper) {
184186
nr_php_arg_release(&exception);
185187
}
186188
NR_PHP_WRAPPER_END
189+
#endif
187190

188191
/*
189192
* Enable Yii2 instrumentation.
@@ -202,7 +205,6 @@ void nr_yii2_enable(TSRMLS_D) {
202205
nr_yii2_runWithParams_wrapper TSRMLS_CC);
203206
nr_php_wrap_user_function(NR_PSTR("yii\\base\\InlineAction::runWithParams"),
204207
nr_yii2_runWithParams_wrapper TSRMLS_CC);
205-
#endif
206208
/*
207209
* Wrap Yii2 global error and exception handling methods.
208210
* Given that: ErrorHandler::handleException(), ::handleError() and
@@ -217,4 +219,5 @@ void nr_yii2_enable(TSRMLS_D) {
217219
*/
218220
nr_php_wrap_user_function(NR_PSTR("yii\\base\\ErrorHandler::logException"),
219221
nr_yii2_error_handler_wrapper TSRMLS_CC);
222+
#endif
220223
}

0 commit comments

Comments
 (0)