Skip to content

Commit 91a6cdb

Browse files
committed
Attempt to fix edge conditions that may cause bug #78106
1 parent f74109d commit 91a6cdb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,16 +1880,22 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
18801880
int key_length;
18811881
int from_shared_memory; /* if the script we've got is stored in SHM */
18821882

1883-
if (!file_handle->filename || !ZCG(enabled) || !accel_startup_ok) {
1883+
if (!file_handle->filename || !ZCG(accelerator_enabled)) {
18841884
/* The Accelerator is disabled, act as if without the Accelerator */
1885+
ZCG(cache_opline) = NULL;
1886+
ZCG(cache_persistent_script) = NULL;
18851887
return accelerator_orig_compile_file(file_handle, type);
18861888
} else if (file_cache_only) {
1889+
ZCG(cache_opline) = NULL;
1890+
ZCG(cache_persistent_script) = NULL;
18871891
return file_cache_compile_file(file_handle, type);
18881892
} else if (!ZCG(accelerator_enabled) ||
18891893
(ZCSG(restart_in_progress) && accel_restart_is_active())) {
18901894
if (ZCG(accel_directives).file_cache) {
18911895
return file_cache_compile_file(file_handle, type);
18921896
}
1897+
ZCG(cache_opline) = NULL;
1898+
ZCG(cache_persistent_script) = NULL;
18931899
return accelerator_orig_compile_file(file_handle, type);
18941900
}
18951901

@@ -1916,10 +1922,14 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
19161922
/* try to find cached script by key */
19171923
key = accel_make_persistent_key(file_handle->filename, strlen(file_handle->filename), &key_length);
19181924
if (!key) {
1925+
ZCG(cache_opline) = NULL;
1926+
ZCG(cache_persistent_script) = NULL;
19191927
return accelerator_orig_compile_file(file_handle, type);
19201928
}
19211929
persistent_script = zend_accel_hash_str_find(&ZCSG(hash), key, key_length);
19221930
} else if (UNEXPECTED(is_stream_path(file_handle->filename) && !is_cacheable_stream_path(file_handle->filename))) {
1931+
ZCG(cache_opline) = NULL;
1932+
ZCG(cache_persistent_script) = NULL;
19231933
return accelerator_orig_compile_file(file_handle, type);
19241934
}
19251935

@@ -3986,6 +3996,7 @@ static int accel_preload(const char *config)
39863996
char *orig_open_basedir;
39873997

39883998
ZCG(enabled) = 0;
3999+
ZCG(accelerator_enabled) = 0;
39894000
orig_open_basedir = PG(open_basedir);
39904001
PG(open_basedir) = NULL;
39914002
preload_orig_compile_file = accelerator_orig_compile_file;

0 commit comments

Comments
 (0)