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