xref: /PHP-7.3/ext/opcache/tests/bug78189.phpt (revision d5e20662)
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
13--FILE--
14<?php
15$tmpdir = sys_get_temp_dir();
16$pattern = $tmpdir . '/*/*/' . str_replace(':', '', __DIR__) . '/bug78189.php.bin';
17$filenames = glob($pattern);
18if (count($filenames)) {
19    foreach ($filenames as $filename) {
20        $part = substr($filename, strlen($tmpdir), 34);
21        if (!preg_match('~/[0-9a-f]{32}/~', $part)) {
22            echo "invalid opcache folder: $part\n";
23        }
24    }
25} else {
26    echo "no opcache file found!\n";
27}
28?>
29--EXPECT--
30