summaryrefslogtreecommitdiff
path: root/ext/opcache/zend_file_cache.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-02 15:01:56 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-01-02 15:01:56 +0100
commit3bc4159a19c8ff23f43ecc6d88200d0a4c3fc081 (patch)
treeedb30f7fca728bd7b07e270dde834e68701e5568 /ext/opcache/zend_file_cache.c
parent0d35f8e3f2daca2c966e04029bde27a5f65bbed7 (diff)
parent36d5fbbd6bceb1e0e1130bb1fff07a702d548594 (diff)
downloadphp-git-3bc4159a19c8ff23f43ecc6d88200d0a4c3fc081.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fix file cache run_time_cache unserialization Update ZCSG(map_ptr_last) only if for_shm
Diffstat (limited to 'ext/opcache/zend_file_cache.c')
-rw-r--r--ext/opcache/zend_file_cache.c10
1 files changed, 9 insertions, 1 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);
+ }
+ }
}
}
}