Skip to content

Commit 07d8159

Browse files
committed
Avoid JIT warning with opcache.jit_buffer_size=0
Closes GH-12460
1 parent 89eb1c6 commit 07d8159

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

ext/opcache/ZendAccelerator.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -3270,7 +3270,11 @@ static zend_result accel_post_startup(void)
32703270
|| zend_jit_startup(ZSMMG(reserved), jit_size, reattached) != SUCCESS) {
32713271
JIT_G(enabled) = 0;
32723272
JIT_G(on) = 0;
3273-
zend_accel_error(ACCEL_LOG_WARNING, "Could not enable JIT!");
3273+
/* The JIT is implicitly disabled with opcache.jit_buffer_size=0, so we don't want to
3274+
* emit a warning here. */
3275+
if (JIT_G(buffer_size) != 0) {
3276+
zend_accel_error(ACCEL_LOG_WARNING, "Could not enable JIT!");
3277+
}
32743278
}
32753279
}
32763280
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
JIT should not emit warning with opcache.jit_buffer_size=0
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=tracing
7+
opcache.jit_buffer_size=0
8+
opcache.log_verbosity_level=2
9+
--EXTENSIONS--
10+
opcache
11+
--FILE--
12+
<?php
13+
var_dump(opcache_get_status()['jit']['enabled'] ?? false);
14+
?>
15+
--EXPECT--
16+
bool(false)

0 commit comments

Comments
 (0)