From 6df1562ad3414b4b445fc8888fd8c2d73b7d2b8e Mon Sep 17 00:00:00 2001 From: Samuel Melrose Date: Tue, 3 Dec 2024 15:14:08 +0000 Subject: [PATCH] fix for file_cache_only --- ext/opcache/tests/gh16551_005.phpt | 3 +++ ext/opcache/tests/gh16551_099.phpt | 6 +++--- ext/opcache/zend_accelerator_module.c | 7 ++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ext/opcache/tests/gh16551_005.phpt b/ext/opcache/tests/gh16551_005.phpt index 8820696fae648..87c08749c8eb9 100644 --- a/ext/opcache/tests/gh16551_005.phpt +++ b/ext/opcache/tests/gh16551_005.phpt @@ -16,6 +16,9 @@ opcache_file_cache $uncached_file = __DIR__ . '/gh16551_999.inc'; +// fix problem on ARM where it was already reporting as cached in SHM. +opcache_invalidate($uncached_file); + var_dump( opcache_is_script_cached($uncached_file) ); diff --git a/ext/opcache/tests/gh16551_099.phpt b/ext/opcache/tests/gh16551_099.phpt index 8fff5a28efbaf..5c5e713f771e6 100644 --- a/ext/opcache/tests/gh16551_099.phpt +++ b/ext/opcache/tests/gh16551_099.phpt @@ -49,15 +49,15 @@ var_dump( --CLEAN-- strlen(__DIR__)) { - rmdir($p); + @rmdir($p); $p = dirname($p); } } diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 2e158229957e1..ad42497887471 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -1037,7 +1037,12 @@ ZEND_FUNCTION(opcache_is_script_cached_in_file_cache) RETURN_FALSE; } - if (!ZCG(accelerator_enabled) || !ZCG(accel_directives).file_cache) { + // account for accelerator_enabled = false when file_cache_only = true + if (!(ZCG(accelerator_enabled) || ZCG(accel_directives).file_cache_only)) { + RETURN_FALSE; + } + + if (!ZCG(accel_directives).file_cache) { RETURN_FALSE; }