Skip to content

Commit b49e178

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Avoid JIT warning with opcache.jit_buffer_size=0
2 parents ef91794 + 07d8159 commit b49e178

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3278,7 +3278,11 @@ static zend_result accel_post_startup(void)
32783278
|| zend_jit_startup(ZSMMG(reserved), jit_size, reattached) != SUCCESS) {
32793279
JIT_G(enabled) = false;
32803280
JIT_G(on) = false;
3281-
zend_accel_error(ACCEL_LOG_WARNING, "Could not enable JIT!");
3281+
/* The JIT is implicitly disabled with opcache.jit_buffer_size=0, so we don't want to
3282+
* emit a warning here. */
3283+
if (JIT_G(buffer_size) != 0) {
3284+
zend_accel_error(ACCEL_LOG_WARNING, "Could not enable JIT!");
3285+
}
32823286
}
32833287
}
32843288
#endif
Lines changed: 16 additions & 0 deletions
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)