summaryrefslogtreecommitdiff
path: root/ext/opcache/ZendAccelerator.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/opcache/ZendAccelerator.c')
-rw-r--r--ext/opcache/ZendAccelerator.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index b62f245f4..875a4727a 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1126,6 +1126,10 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
return new_persistent_script;
}
+ if (!compact_persistent_script(new_persistent_script)) {
+ return new_persistent_script;
+ }
+
/* exclusive lock */
zend_shared_alloc_lock(TSRMLS_C);
@@ -1613,10 +1617,12 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
from_shared_memory = 0;
persistent_script = compile_and_cache_file(file_handle, type, key, key_length, &op_array, &from_shared_memory TSRMLS_CC);
- /* Something went wrong during compilation, returning NULL */
+ /* Caching is disabled, returning op_array;
+ * or something went wrong during compilation, returning NULL
+ */
if (!persistent_script) {
SHM_PROTECT();
- return op_array; /* Presently always NULL, but not necessary in the future */
+ return op_array;
}
} else {
@@ -2579,7 +2585,9 @@ static int accel_startup(zend_extension *extension)
ZCG(include_path_key) = NULL;
if (ZCG(include_path) && *ZCG(include_path)) {
ZCG(include_path_len) = strlen(ZCG(include_path));
- if (!zend_accel_hash_is_full(&ZCSG(include_paths))) {
+ ZCG(include_path_key) = zend_accel_hash_find(&ZCSG(include_paths), ZCG(include_path), ZCG(include_path_len) + 1);
+ if (!ZCG(include_path_key) &&
+ !zend_accel_hash_is_full(&ZCSG(include_paths))) {
char *key;
zend_shared_alloc_lock(TSRMLS_C);