xref: /PHP-8.1/ext/opcache/tests/blacklist.phpt (revision e9f783fc)
1--TEST--
2Blacklist (with glob, quote and comments)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.blacklist_filename={PWD}/opcache-*.blacklist
7opcache.file_update_protection=0
8opcache.file_cache_only=0
9opcache.preload=
10--EXTENSIONS--
11opcache
12--SKIPIF--
13<?php
14if (substr(PHP_OS, 0, 3) == 'WIN') {
15    die('skip not for Windows');
16}
17/* On macOS, `/tmp` is an alias to `/private/tmp` .
18 * So, we should write `%S/tmp/path` as `/tmp/path`, except for Windows.
19 */
20?>
21--FILE--
22<?php
23$conf = opcache_get_configuration();
24$conf = $conf['blacklist'];
25$conf[3] = preg_replace("!^\\Q".__DIR__."\\E!", "__DIR__", $conf[3]);
26$conf[4] = preg_replace("!^\\Q".__DIR__."\\E!", "__DIR__", $conf[4]);
27print_r($conf);
28include("blacklist.inc");
29$status = opcache_get_status();
30print_r(count($status['scripts']));
31?>
32--EXPECTF--
33Array
34(
35    [0] => /path/to/foo
36    [1] => /path/to/foo2
37    [2] => /path/to/bar
38    [3] => __DIR__/blacklist.inc
39    [4] => __DIR__/current.php
40    [5] => %S/tmp/path/?nocache.inc
41    [6] => %S/tmp/path/*/somedir
42)
43ok
441
45