Skip to content

Commit 3702f97

Browse files
committed
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.
1 parent 301b8e2 commit 3702f97

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PHP NEWS
88
- Iconv:
99
. Fixed bug GH-17047 (UAF on iconv filter failure). (nielsdos)
1010

11+
- Opcache:
12+
. opcache_get_configuration() properly reports jit_prof_threshold. (cmb)
13+
1114
- SimpleXML:
1215
. Fixed bug GH-17040 (SimpleXML's unset can break DOM objects). (nielsdos)
1316

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
opcache_get_configuration() properly reports jit_prof_threshold
3+
--EXTENSIONS--
4+
opcache
5+
--SKIPIF--
6+
<?php
7+
if (!isset(opcache_get_configuration()["directives"]["opcache.jit_prof_threshold"])) die("skip no JIT");
8+
?>
9+
--FILE--
10+
<?php
11+
$expected = 1 / 128; // needs to be exactly representable as IEEE double
12+
ini_set("opcache.jit_prof_threshold", $expected);
13+
$actual = opcache_get_configuration()["directives"]["opcache.jit_prof_threshold"];
14+
var_dump($actual);
15+
var_dump($actual === $expected);
16+
?>
17+
--EXPECTF--
18+
float(0.0078125)
19+
bool(true)

ext/opcache/zend_accelerator_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ ZEND_FUNCTION(opcache_get_configuration)
849849
add_assoc_long(&directives, "opcache.jit_max_recursive_returns", JIT_G(max_recursive_returns));
850850
add_assoc_long(&directives, "opcache.jit_max_root_traces", JIT_G(max_root_traces));
851851
add_assoc_long(&directives, "opcache.jit_max_side_traces", JIT_G(max_side_traces));
852-
add_assoc_long(&directives, "opcache.jit_prof_threshold", JIT_G(prof_threshold));
852+
add_assoc_double(&directives, "opcache.jit_prof_threshold", JIT_G(prof_threshold));
853853
add_assoc_long(&directives, "opcache.jit_max_trace_length", JIT_G(max_trace_length));
854854
#endif
855855

0 commit comments

Comments
 (0)