summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-10-18 16:27:31 +0200
committerAnatol Belski <ab@php.net>2017-10-18 16:27:31 +0200
commit5315cea6e276f96b8f44341df8527661dd6699ee (patch)
treec6bbac7d6f92ef760427abcf3a22cc1df3332217 /ext/opcache
parent63a0ddb0135c3c60a64e8d7dd81eb546d38a4dd9 (diff)
parent53d8775015bbccc50e54c382851f64026c73a2d9 (diff)
downloadphp-git-5315cea6e276f96b8f44341df8527661dd6699ee.tar.gz
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Backport 7ff13badda58b966ff8fbcc61add48bb5b14117b into 7.0+
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/ZendAccelerator.c4
-rw-r--r--ext/opcache/zend_persist.h2
-rw-r--r--ext/opcache/zend_persist_calc.c10
3 files changed, 9 insertions, 7 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 32db2ca9e9..6d18ea1bd7 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1267,7 +1267,7 @@ static zend_persistent_script *cache_script_in_file_cache(zend_persistent_script
zend_shared_alloc_init_xlat_table();
/* Calculate the required memory size */
- memory_used = zend_accel_script_persist_calc(new_persistent_script, NULL, 0);
+ memory_used = zend_accel_script_persist_calc(new_persistent_script, NULL, 0, 0);
/* Allocate memory block */
#ifdef __SSE2__
@@ -1355,7 +1355,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
zend_shared_alloc_init_xlat_table();
/* Calculate the required memory size */
- memory_used = zend_accel_script_persist_calc(new_persistent_script, key, key_length);
+ memory_used = zend_accel_script_persist_calc(new_persistent_script, key, key_length, 1);
/* Allocate shared memory */
#ifdef __SSE2__
diff --git a/ext/opcache/zend_persist.h b/ext/opcache/zend_persist.h
index a87774a116..f1a036b880 100644
--- a/ext/opcache/zend_persist.h
+++ b/ext/opcache/zend_persist.h
@@ -23,7 +23,7 @@
#define ZEND_PERSIST_H
int zend_accel_script_persistable(zend_persistent_script *script);
-uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, char *key, unsigned int key_length);
+uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, char *key, unsigned int key_length, int for_shm);
zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length);
#endif /* ZEND_PERSIST_H */
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index cb7eb11b7a..232a26d12a 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -395,7 +395,7 @@ static void zend_accel_persist_class_table_calc(HashTable *class_table)
zend_hash_persist_calc(class_table, zend_persist_class_entry_calc);
}
-uint32_t zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length)
+uint32_t zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length, int for_shm)
{
new_persistent_script->mem = NULL;
new_persistent_script->size = 0;
@@ -404,12 +404,14 @@ uint32_t zend_accel_script_persist_calc(zend_persistent_script *new_persistent_s
new_persistent_script->corrupted = 0;
ZCG(current_persistent_script) = new_persistent_script;
+ if (!for_shm) {
+ /* script is not going to be saved in SHM */
+ new_persistent_script->corrupted = 1;
+ }
+
ADD_DUP_SIZE(new_persistent_script, sizeof(zend_persistent_script));
if (key) {
ADD_DUP_SIZE(key, key_length + 1);
- } else {
- /* script is not going to be saved in SHM */
- new_persistent_script->corrupted = 1;
}
ADD_STRING(new_persistent_script->script.filename);