From 3702f9783b6367b7c94e2c11ede0896352da5cfe Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sat, 7 Dec 2024 12:39:07 +0100 Subject: [PATCH] opcache_get_configuration() properly reports jit_prof_threshold The `jit_prof_threshold` is a float, supposed to be in range [0, 1], and usually very small (the default is 0.005). Reporting it as int is meaningless. Closes GH-17077. --- NEWS | 3 +++ .../tests/opcache_jit_prof_threshold.phpt | 19 +++++++++++++++++++ ext/opcache/zend_accelerator_module.c | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 ext/opcache/tests/opcache_jit_prof_threshold.phpt diff --git a/NEWS b/NEWS index 32d837a47b6..09abb4f1ab1 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ PHP NEWS - Iconv: . Fixed bug GH-17047 (UAF on iconv filter failure). (nielsdos) +- Opcache: + . opcache_get_configuration() properly reports jit_prof_threshold. (cmb) + - SimpleXML: . Fixed bug GH-17040 (SimpleXML's unset can break DOM objects). (nielsdos) diff --git a/ext/opcache/tests/opcache_jit_prof_threshold.phpt b/ext/opcache/tests/opcache_jit_prof_threshold.phpt new file mode 100644 index 00000000000..f98c12b99ba --- /dev/null +++ b/ext/opcache/tests/opcache_jit_prof_threshold.phpt @@ -0,0 +1,19 @@ +--TEST-- +opcache_get_configuration() properly reports jit_prof_threshold +--EXTENSIONS-- +opcache +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +float(0.0078125) +bool(true) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 5c69c9f7883..90936929f84 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -849,7 +849,7 @@ ZEND_FUNCTION(opcache_get_configuration) add_assoc_long(&directives, "opcache.jit_max_recursive_returns", JIT_G(max_recursive_returns)); add_assoc_long(&directives, "opcache.jit_max_root_traces", JIT_G(max_root_traces)); add_assoc_long(&directives, "opcache.jit_max_side_traces", JIT_G(max_side_traces)); - add_assoc_long(&directives, "opcache.jit_prof_threshold", JIT_G(prof_threshold)); + add_assoc_double(&directives, "opcache.jit_prof_threshold", JIT_G(prof_threshold)); add_assoc_long(&directives, "opcache.jit_max_trace_length", JIT_G(max_trace_length)); #endif