Skip to content

Commit 6df1562

Browse files
committed
fix for file_cache_only
1 parent f620d9c commit 6df1562

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

ext/opcache/tests/gh16551_005.phpt

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ opcache_file_cache
1616

1717
$uncached_file = __DIR__ . '/gh16551_999.inc';
1818

19+
// fix problem on ARM where it was already reporting as cached in SHM.
20+
opcache_invalidate($uncached_file);
21+
1922
var_dump(
2023
opcache_is_script_cached($uncached_file)
2124
);

ext/opcache/tests/gh16551_099.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ var_dump(
4949
--CLEAN--
5050
<?php
5151
if (substr(PHP_OS, 0, 3) !== 'WIN') {
52-
$pattern = __DIR__ . '/*/' . __DIR__ . '/*16551_999.inc.bin';
52+
$pattern = __DIR__ . '/*/' . __DIR__ . '/*16551*.bin';
5353
} else {
54-
$pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*16551_999.inc.bin';
54+
$pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*16551*.bin';
5555
}
5656
foreach (glob($pattern) as $p) {
5757
unlink($p);
5858
$p = dirname($p);
5959
while(strlen($p) > strlen(__DIR__)) {
60-
rmdir($p);
60+
@rmdir($p);
6161
$p = dirname($p);
6262
}
6363
}

ext/opcache/zend_accelerator_module.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,12 @@ ZEND_FUNCTION(opcache_is_script_cached_in_file_cache)
10371037
RETURN_FALSE;
10381038
}
10391039

1040-
if (!ZCG(accelerator_enabled) || !ZCG(accel_directives).file_cache) {
1040+
// account for accelerator_enabled = false when file_cache_only = true
1041+
if (!(ZCG(accelerator_enabled) || ZCG(accel_directives).file_cache_only)) {
1042+
RETURN_FALSE;
1043+
}
1044+
1045+
if (!ZCG(accel_directives).file_cache) {
10411046
RETURN_FALSE;
10421047
}
10431048

0 commit comments

Comments
 (0)