in prod/native/libphpbridge/code/OpCache.cpp [74:109]
bool PhpBridge::detectOpcacheRestartPending() const {
if (!isOpcacheEnabled()) {
return false;
}
if (EG(function_table) && !zend_hash_str_find_ptr(EG(function_table), ZEND_STRL("opcache_get_status"))) {
return false;
}
AutoZval rv;
rv.setNull();
AutoZval parameters{false};
int originalErrorReportingState = EG(error_reporting); // suppress error/warning reporing
EG(error_reporting) = 0;
bool result = callMethod(NULL, "opcache_get_status", parameters.get(), 1, rv.get());
EG(error_reporting) = originalErrorReportingState;
if (!result) {
ELOGF_ERROR(log_, REQUEST, "opcache_get_status failure");
return false;
}
if (Z_TYPE(*rv) != IS_ARRAY) {
ELOGF_DEBUG(log_, REQUEST, "opcache_get_status failed, rvtype: %d", Z_TYPE(*rv));
return false;
}
zval *restartPending = zend_hash_str_find(Z_ARRVAL(*rv), ZEND_STRL("restart_pending"));
if (restartPending && Z_TYPE_P(restartPending) == IS_TRUE) {
return true;
} else if (!restartPending || Z_TYPE_P(restartPending) != IS_FALSE) {
ELOGF_DEBUG(log_, REQUEST, "opcache_get_status returned unexpected data ptr: %p t:%d", restartPending, restartPending ? Z_TYPE_P(restartPending) : -1);
}
return false;
}