From 3a425a3cf904fc780c9c9cb3ec1d34a58f1c4997 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 14 Feb 2025 11:37:45 +0100 Subject: [PATCH] Fixed calling of original compile function (#64) (#170) --- prod/native/extension/code/Hooking.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prod/native/extension/code/Hooking.cpp b/prod/native/extension/code/Hooking.cpp index c18771f..f61c995 100644 --- a/prod/native/extension/code/Hooking.cpp +++ b/prod/native/extension/code/Hooking.cpp @@ -118,16 +118,18 @@ static zend_op_array *elastic_compile_file(zend_file_handle *file_handle, int ty return nullptr; } + zend_op_array *ret = nullptr; zend_try { if (Hooking::getInstance().getOriginalZendCompileFile()) { - return Hooking::getInstance().getOriginalZendCompileFile()(file_handle, type); + ret = Hooking::getInstance().getOriginalZendCompileFile()(file_handle, type); } } zend_catch { ELOGF_DEBUG(ELASTICAPM_G(globals)->logger_, HOOKS, "%s: original call error", __FUNCTION__); + ret = nullptr; } zend_end_try(); - return nullptr; + return ret; } void Hooking::replaceHooks(bool enableInferredSpansHooks, bool enableDepenecyAutoloaderGuard) {