|
| 1 | +--TEST-- |
| 2 | +GH-16551: opcache file cache read only: double check file_cache_only |
| 3 | +--INI-- |
| 4 | +opcache.enable=1 |
| 5 | +opcache.enable_cli=1 |
| 6 | +opcache.jit=disable |
| 7 | +opcache.jit_buffer_size=0 |
| 8 | +opcache.file_cache="{PWD}" |
| 9 | +opcache.file_cache_only=1 |
| 10 | +--EXTENSIONS-- |
| 11 | +opcache |
| 12 | +--CONFLICTS-- |
| 13 | +opcache_file_cache |
| 14 | +--FILE-- |
| 15 | +<?php |
| 16 | + |
| 17 | +$uncached_file = __DIR__ . '/gh16551_999.inc'; |
| 18 | + |
| 19 | +var_dump( |
| 20 | + opcache_is_script_cached($uncached_file) |
| 21 | +); |
| 22 | + |
| 23 | +var_dump( |
| 24 | + opcache_is_script_cached_in_file_cache($uncached_file) |
| 25 | +); |
| 26 | + |
| 27 | +opcache_compile_file($uncached_file); |
| 28 | + |
| 29 | +var_dump( |
| 30 | + opcache_is_script_cached($uncached_file) |
| 31 | +); |
| 32 | + |
| 33 | +// check the cache file itself exists... |
| 34 | +if (substr(PHP_OS, 0, 3) !== 'WIN') { |
| 35 | + $pattern = __DIR__ . '/*/' . __DIR__ . '/*16551_999.inc.bin'; |
| 36 | +} else { |
| 37 | + $pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*16551_999.inc.bin'; |
| 38 | +} |
| 39 | +foreach (glob($pattern) as $p) { |
| 40 | + var_dump($p !== false); |
| 41 | +} |
| 42 | + |
| 43 | +// check it is reported as existing... |
| 44 | +var_dump( |
| 45 | + opcache_is_script_cached_in_file_cache($uncached_file) |
| 46 | +); |
| 47 | + |
| 48 | +?> |
| 49 | +--CLEAN-- |
| 50 | +<?php |
| 51 | +if (substr(PHP_OS, 0, 3) !== 'WIN') { |
| 52 | + $pattern = __DIR__ . '/*/' . __DIR__ . '/*16551_999.inc.bin'; |
| 53 | +} else { |
| 54 | + $pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*16551_999.inc.bin'; |
| 55 | +} |
| 56 | +foreach (glob($pattern) as $p) { |
| 57 | + unlink($p); |
| 58 | + $p = dirname($p); |
| 59 | + while(strlen($p) > strlen(__DIR__)) { |
| 60 | + rmdir($p); |
| 61 | + $p = dirname($p); |
| 62 | + } |
| 63 | +} |
| 64 | +?> |
| 65 | +--EXPECT-- |
| 66 | +bool(false) |
| 67 | +bool(false) |
| 68 | +bool(false) |
| 69 | +bool(true) |
| 70 | +bool(true) |
0 commit comments