Skip to content

Commit

Permalink
fix for file_cache_only
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacarpet committed Dec 3, 2024
1 parent f620d9c commit 6df1562
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ext/opcache/tests/gh16551_005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down
6 changes: 3 additions & 3 deletions ext/opcache/tests/gh16551_099.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ var_dump(
--CLEAN--
<?php
if (substr(PHP_OS, 0, 3) !== 'WIN') {
$pattern = __DIR__ . '/*/' . __DIR__ . '/*16551_999.inc.bin';
$pattern = __DIR__ . '/*/' . __DIR__ . '/*16551*.bin';
} else {
$pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*16551_999.inc.bin';
$pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*16551*.bin';
}
foreach (glob($pattern) as $p) {
unlink($p);
$p = dirname($p);
while(strlen($p) > strlen(__DIR__)) {
rmdir($p);
@rmdir($p);
$p = dirname($p);
}
}
Expand Down
7 changes: 6 additions & 1 deletion ext/opcache/zend_accelerator_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6df1562

Please sign in to comment.