diff --git a/agent/native/ext/util_for_PHP.c b/agent/native/ext/util_for_PHP.c index 795f611a4..7fe1cebd3 100644 --- a/agent/native/ext/util_for_PHP.c +++ b/agent/native/ext/util_for_PHP.c @@ -308,13 +308,19 @@ bool detectOpcacheRestartPending() { zval parameters[1]; ZVAL_BOOL(¶meters[0], false); + int er = EG(error_reporting); // suppress error/warning reporing + EG(error_reporting) = 0; int result = call_internal_function(NULL, "opcache_get_status", parameters, 1, &rv); + EG(error_reporting) = er; + if (result == resultFailure) { + ELASTIC_APM_LOG_ERROR("opcache_get_status failure"); zval_ptr_dtor(&rv); return false; } if (Z_TYPE(rv) != IS_ARRAY) { + ELASTIC_APM_LOG_WARNING("opcache_get_status failed, rvtype: %d", Z_TYPE(rv)); zval_ptr_dtor(&rv); return false; }