com php-src: Attempt to fix edge conditions that may cause bug #78106: ext/opcache/ZendAccelerator.c
| From: | Dmitry Stogov | Date: | Fri, 14 Jun 2019 09:47:22 +0000 |
| Subject: | com php-src: Attempt to fix edge conditions that may cause bug #78106: ext/opcache/ZendAccelerator.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106782@lists.php.net to get a copy of this message | ||
Commit: 91a6cdbff5ebd1ca4db1d6e8c42d3265ce80ace4
Author: Dmitry Stogov <dmitry@zend.com> Fri, 14 Jun 2019 12:47:22 +0300
Parents: f74109d9a4b1e4fbaeba4f68c8fc89950e19d265
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=91a6cdbff5ebd1ca4db1d6e8c42d3265ce80ace4
Log:
Attempt to fix edge conditions that may cause bug #78106
Bugs:
https://bugs.php.net/78106
Changed paths:
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index b0aace8..995d21d 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1880,16 +1880,22 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
type)
int key_length;
int from_shared_memory; /* if the script we've got is stored in SHM */
- if (!file_handle->filename || !ZCG(enabled) || !accel_startup_ok) {
+ if (!file_handle->filename || !ZCG(accelerator_enabled)) {
/* The Accelerator is disabled, act as if without the Accelerator */
+ ZCG(cache_opline) = NULL;
+ ZCG(cache_persistent_script) = NULL;
return accelerator_orig_compile_file(file_handle, type);
} else if (file_cache_only) {
+ ZCG(cache_opline) = NULL;
+ ZCG(cache_persistent_script) = NULL;
return file_cache_compile_file(file_handle, type);
} else if (!ZCG(accelerator_enabled) ||
(ZCSG(restart_in_progress) && accel_restart_is_active())) {
if (ZCG(accel_directives).file_cache) {
return file_cache_compile_file(file_handle, type);
}
+ ZCG(cache_opline) = NULL;
+ ZCG(cache_persistent_script) = NULL;
return accelerator_orig_compile_file(file_handle, type);
}
@@ -1916,10 +1922,14 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
type)
/* try to find cached script by key */
key = accel_make_persistent_key(file_handle->filename, strlen(file_handle->filename),
&key_length);
if (!key) {
+ ZCG(cache_opline) = NULL;
+ ZCG(cache_persistent_script) = NULL;
return accelerator_orig_compile_file(file_handle, type);
}
persistent_script = zend_accel_hash_str_find(&ZCSG(hash), key, key_length);
} else if (UNEXPECTED(is_stream_path(file_handle->filename) &&
!is_cacheable_stream_path(file_handle->filename))) {
+ ZCG(cache_opline) = NULL;
+ ZCG(cache_persistent_script) = NULL;
return accelerator_orig_compile_file(file_handle, type);
}
@@ -3986,6 +3996,7 @@ static int accel_preload(const char *config)
char *orig_open_basedir;
ZCG(enabled) = 0;
+ ZCG(accelerator_enabled) = 0;
orig_open_basedir = PG(open_basedir);
PG(open_basedir) = NULL;
preload_orig_compile_file = accelerator_orig_compile_file;