Skip to content

Commit 9506ca6

Browse files
committed
Fix enabling of JIT at runtime
Fixes GH-14267 Closes GH-14294
1 parent 151f56b commit 9506ca6

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.2.21
44

5+
- Opcache:
6+
. Fixed bug GH-14267 (opcache.jit=off does not allow enabling JIT at runtime).
7+
(ilutov)
8+
59
- SPL:
610
. Fixed bug GH-14290 (Member access within null pointer in extension spl).
711
(nielsdos)

ext/opcache/jit/zend_jit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4785,12 +4785,12 @@ ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
47854785
return FAILURE;
47864786
}
47874787

4788-
if (ZSTR_LEN(jit) == 0
4789-
|| zend_string_equals_literal_ci(jit, "disable")) {
4788+
if (zend_string_equals_literal_ci(jit, "disable")) {
47904789
JIT_G(enabled) = 0;
47914790
JIT_G(on) = 0;
47924791
return SUCCESS;
4793-
} else if (zend_string_equals_literal_ci(jit, "0")
4792+
} else if (ZSTR_LEN(jit) == 0
4793+
|| zend_string_equals_literal_ci(jit, "0")
47944794
|| zend_string_equals_literal_ci(jit, "off")
47954795
|| zend_string_equals_literal_ci(jit, "no")
47964796
|| zend_string_equals_literal_ci(jit, "false")) {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
GH-14267: JIT cannot be enabled at runtime
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=off
7+
opcache.jit_buffer_size=32M
8+
--EXTENSIONS--
9+
opcache
10+
--FILE--
11+
<?php
12+
ini_set('opcache.jit', 'tracing');
13+
?>
14+
===DONE===
15+
--EXPECT--
16+
===DONE===
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
GH-14267: JIT cannot be enabled at runtime
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=disable
7+
opcache.jit_buffer_size=32M
8+
--EXTENSIONS--
9+
opcache
10+
--FILE--
11+
<?php
12+
ini_set('opcache.jit', 'tracing');
13+
?>
14+
--EXPECTF--
15+
Warning: Cannot change opcache.jit setting at run-time (JIT is disabled) in %s on line %d

0 commit comments

Comments
 (0)