From fd42cdbd0a6a08ab16f7aebe26082fcc1c897bd5 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 29 Aug 2024 16:45:15 +0300 Subject: [PATCH] Fix GH-15497: Opcache with file_cache and JIT enabled crashes (#15635) --- ext/opcache/zend_persist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 990ad64ed99..8274af01942 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -689,7 +689,10 @@ static void zend_persist_op_array(zval *zv) } } #ifdef HAVE_JIT - if (JIT_G(on) && JIT_G(opt_level) <= ZEND_JIT_LEVEL_OPT_FUNCS) { + if (JIT_G(on) + && JIT_G(opt_level) <= ZEND_JIT_LEVEL_OPT_FUNCS + && (!ZCG(current_persistent_script) + || !ZCG(current_persistent_script)->corrupted)) { zend_jit_op_array(op_array, ZCG(current_persistent_script) ? &ZCG(current_persistent_script)->script : NULL); } #endif