diff options
-rw-r--r-- | ext/opcache/zend_file_cache.c | 10 | ||||
-rw-r--r-- | ext/opcache/zend_persist.c | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 049b0e9b48..d5d0cb4466 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -1282,7 +1282,15 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr ZEND_MAP_PTR_NEW(op_array->run_time_cache); } else { ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables); - UNSERIALIZE_PTR(ZEND_MAP_PTR(op_array->run_time_cache)); + if (ZEND_MAP_PTR(op_array->run_time_cache)) { + if (script->corrupted) { + /* Not in SHM: Use serialized arena pointer. */ + UNSERIALIZE_PTR(ZEND_MAP_PTR(op_array->run_time_cache)); + } else { + /* In SHM: Allocate new pointer. */ + ZEND_MAP_PTR_NEW(op_array->run_time_cache); + } + } } } } diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index e78e3cbfce..cbf91144f3 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -1138,7 +1138,9 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script } ZEND_HASH_FOREACH_END(); zend_persist_op_array_ex(&script->script.main_op_array, script); - ZCSG(map_ptr_last) = CG(map_ptr_last); + if (for_shm) { + ZCSG(map_ptr_last) = CG(map_ptr_last); + } #ifdef HAVE_JIT if (ZCG(jit_enabled) && for_shm) { |