diff --git a/prod/native/extension/code/Hooking.cpp b/prod/native/extension/code/Hooking.cpp index 4e6d998..da450ba 100644 --- a/prod/native/extension/code/Hooking.cpp +++ b/prod/native/extension/code/Hooking.cpp @@ -74,9 +74,8 @@ void elastic_observer_error_cb(int type, zend_string *error_filename, uint32_t e ELOGF_WARNING(ELASTICAPM_G(globals)->logger_, HOOKS, "elastic_observer_error_cb currentED: %p currentEXception: %p func null, msg: " PRsv, EG(current_execute_data), EG(exception), PRsvArg(msg)); } } - errorHandling = true; - ELASTICAPM_G(globals)->requestScope_->handleError(type, fileName, error_lineno, msg); + ELASTICAPM_G(globals)->requestScope_->handleError(type, fileName, error_lineno, msg, static_cast(EG(current_execute_data))); errorHandling = false; } diff --git a/prod/native/libcommon/code/RequestScope.h b/prod/native/libcommon/code/RequestScope.h index 79473cf..2bd7d1f 100644 --- a/prod/native/libcommon/code/RequestScope.h +++ b/prod/native/libcommon/code/RequestScope.h @@ -141,12 +141,12 @@ class RequestScope { } } - bool handleError(int type, std::string_view errorFilename, uint32_t errorLineno, std::string_view message) { - ELOGF_DEBUG(log_, REQUEST, "RequestScope::handleError type: %d fn: %s:%d msg: %s", type, errorFilename.data(), errorLineno, message.data()); + void handleError(int type, std::string_view errorFilename, uint32_t errorLineno, std::string_view message, bool callPHPHandler) { + ELOGF_DEBUG(log_, REQUEST, "RequestScope::handleError calling handler: %d, type: %d fn: %s:%d msg: %s", callPHPHandler, type, errorFilename.data(), errorLineno, message.data()); - bridge_->callPHPSideErrorHandler(type, errorFilename, errorLineno, message); - - return false; + if (callPHPHandler) { + bridge_->callPHPSideErrorHandler(type, errorFilename, errorLineno, message); + } } bool isFunctional() {