Avoid JIT warning with opcache.jit_buffer_size=0

Closes GH-12460
This commit is contained in:
Ilija Tovilo 2023-10-17 18:09:44 +02:00
parent 89eb1c64a9
commit 07d81592e9
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
2 changed files with 21 additions and 1 deletions

View file

@ -3270,9 +3270,13 @@ static zend_result accel_post_startup(void)
|| zend_jit_startup(ZSMMG(reserved), jit_size, reattached) != SUCCESS) { || zend_jit_startup(ZSMMG(reserved), jit_size, reattached) != SUCCESS) {
JIT_G(enabled) = 0; JIT_G(enabled) = 0;
JIT_G(on) = 0; JIT_G(on) = 0;
/* The JIT is implicitly disabled with opcache.jit_buffer_size=0, so we don't want to
* emit a warning here. */
if (JIT_G(buffer_size) != 0) {
zend_accel_error(ACCEL_LOG_WARNING, "Could not enable JIT!"); zend_accel_error(ACCEL_LOG_WARNING, "Could not enable JIT!");
} }
} }
}
#endif #endif
zend_shared_alloc_save_state(); zend_shared_alloc_save_state();
zend_shared_alloc_unlock(); zend_shared_alloc_unlock();

View file

@ -0,0 +1,16 @@
--TEST--
JIT should not emit warning with opcache.jit_buffer_size=0
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.jit=tracing
opcache.jit_buffer_size=0
opcache.log_verbosity_level=2
--EXTENSIONS--
opcache
--FILE--
<?php
var_dump(opcache_get_status()['jit']['enabled'] ?? false);
?>
--EXPECT--
bool(false)