xref: /PHP-8.3/ext/opcache/tests/bug78189.phpt (revision e9f783fc)
1--TEST--
2Bug #78189 (file cache strips last character of uname hash)
3--EXTENSIONS--
4opcache
5--SKIPIF--
6<?php
7if (substr(PHP_OS, 0, 3) !== 'WIN') die('skip this test is for Windows platforms only');
8?>
9--INI--
10opcache.enable_cli=1
11opcache.optimization_level=-1
12opcache.file_cache="{TMP}"
13opcache.file_cache_only=1
14opcache.jit=0
15--FILE--
16<?php
17$tmpdir = sys_get_temp_dir();
18$pattern = $tmpdir . '/*/*/' . str_replace(':', '', __DIR__) . '/bug78189.php.bin';
19$filenames = glob($pattern);
20if (count($filenames)) {
21    foreach ($filenames as $filename) {
22        $part = substr($filename, strlen($tmpdir), 34);
23        if (!preg_match('~/[0-9a-f]{32}/~', $part)) {
24            echo "invalid opcache folder: $part\n";
25        }
26    }
27} else {
28    echo "no opcache file found!\n";
29}
30?>
31--EXPECT--
32