Skip to content

Commit

Permalink
Suppress errors and warnings when internally calling opcache_get_stat…
Browse files Browse the repository at this point in the history
…us (1008) (#1013)
  • Loading branch information
intuibase authored Jul 3, 2023
1 parent 13e8b0b commit 8650c9c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions agent/native/ext/util_for_PHP.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,19 @@ bool detectOpcacheRestartPending() {
zval parameters[1];
ZVAL_BOOL(&parameters[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;
}
Expand Down

0 comments on commit 8650c9c

Please sign in to comment.