summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-06-25 09:56:33 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-06-25 13:00:28 +0200
commit4366f22dfcadfa080862c3fcbac8e0e42f05bf62 (patch)
tree3cc8a1d92b6c23a8268d8b92a445f519a7d5457a
parent102c64e8274e072426c95f8805dd727e87c5f69d (diff)
downloadphp-git-4366f22dfcadfa080862c3fcbac8e0e42f05bf62.tar.gz
Fix #78202: Opcache stats for cache hits are capped at 32bit NUM
We use the proper format specifiers now.
-rw-r--r--NEWS1
-rw-r--r--ext/opcache/zend_accelerator_module.c24
2 files changed, 13 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index ae34c8f442..14b7b612c7 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ PHP NEWS
- OPcache:
. Fixed #78189 (file cache strips last character of uname hash). (cmb)
+ . Fixed #78202 (Opcache stats for cache hits are capped at 32bit NUM). (cmb)
27 Jun 2019, PHP 7.2.20
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index d74b2ac644..ef80ffa630 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -482,33 +482,33 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
char buf[32];
php_info_print_table_row(2, "Startup", "OK");
php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model());
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, (zend_ulong)ZCSG(hits));
+ snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, ZCSG(hits));
php_info_print_table_row(2, "Cache hits", buf);
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
+ snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
php_info_print_table_row(2, "Cache misses", buf);
snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
php_info_print_table_row(2, "Used memory", buf);
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, zend_shared_alloc_get_free_memory());
+ snprintf(buf, sizeof(buf), "%zu", zend_shared_alloc_get_free_memory());
php_info_print_table_row(2, "Free memory", buf);
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZSMMG(wasted_shared_memory));
+ snprintf(buf, sizeof(buf), "%zu", ZSMMG(wasted_shared_memory));
php_info_print_table_row(2, "Wasted memory", buf);
if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) {
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
+ snprintf(buf, sizeof(buf), "%td", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
php_info_print_table_row(2, "Interned Strings Used memory", buf);
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
+ snprintf(buf, sizeof(buf), "%td", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
php_info_print_table_row(2, "Interned Strings Free memory", buf);
}
- snprintf(buf, sizeof(buf), "%d", ZCSG(hash).num_direct_entries);
+ snprintf(buf, sizeof(buf), "%" PRIu32, ZCSG(hash).num_direct_entries);
php_info_print_table_row(2, "Cached scripts", buf);
- snprintf(buf, sizeof(buf), "%d", ZCSG(hash).num_entries);
+ snprintf(buf, sizeof(buf), "%" PRIu32, ZCSG(hash).num_entries);
php_info_print_table_row(2, "Cached keys", buf);
- snprintf(buf, sizeof(buf), "%d", ZCSG(hash).max_num_entries);
+ snprintf(buf, sizeof(buf), "%" PRIu32, ZCSG(hash).max_num_entries);
php_info_print_table_row(2, "Max keys", buf);
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(oom_restarts));
+ snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, ZCSG(oom_restarts));
php_info_print_table_row(2, "OOM restarts", buf);
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(hash_restarts));
+ snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, ZCSG(hash_restarts));
php_info_print_table_row(2, "Hash keys restarts", buf);
- snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(manual_restarts));
+ snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, ZCSG(manual_restarts));
php_info_print_table_row(2, "Manual restarts", buf);
}
}