1--TEST--
2File cache error 001
3--EXTENSIONS--
4opcache
5posix
6pcntl
7--INI--
8opcache.enable_cli=1
9opcache.file_cache="{TMP}"
10opcache.log_verbosity_level=2
11opcache.interned_strings_buffer=8
12--SKIPIF--
13<?php
14if (!posix_setrlimit(POSIX_RLIMIT_FSIZE, 1, -1)) die('skip Test requires setrlimit(RLIMIT_FSIZE) to work');
15if (ini_parse_quantity(ini_get('opcache.jit_buffer_size')) !== 0) die('skip File cache is disabled when JIT is on');
16// Allow gcov to write to file
17posix_setrlimit(POSIX_RLIMIT_FSIZE, -1, -1);
18?>
19--FILE--
20<?php
21
22// Create new file to ensure that it's not cached accross test runs
23$file = tempnam(sys_get_temp_dir(), 'file_cache_error');
24register_shutdown_function(function () use ($file) {
25    unlink($file);
26});
27file_put_contents($file, '<?php echo "OK";');
28touch($file, time() - 3600);
29
30// Some systems will raise SIGXFSZ when RLIMIT_FSIZE is exceeded
31if (defined('SIGXFSZ')) {
32    pcntl_signal(SIGXFSZ, SIG_IGN);
33}
34
35// Should cause writing to cache file to fail
36var_dump(posix_setrlimit(POSIX_RLIMIT_FSIZE, 1, -1));
37
38// Will attempt to write to cache file, and fail
39require $file;
40
41// Allow gcov to write to file
42posix_setrlimit(POSIX_RLIMIT_FSIZE, -1, -1);
43?>
44--EXPECTF--
45bool(true)
46%sWarning opcache cannot write to file %s: %s
47
48OK
49