mirror of
https://github.com/php/php-src.git
synced 2026-03-31 04:32:19 +02:00
This test is easily tripped by former test runs with other PHP versions. To avoid such false positives, we check that there is at least one respective OPcache file, and that all found OPcache user ID folders have exactly 32 hexadecimal digits.
30 lines
835 B
PHP
30 lines
835 B
PHP
--TEST--
|
|
Bug #78189 (file cache strips last character of uname hash)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('Zend OPcache')) die('skip opcache extension not available');
|
|
if (substr(PHP_OS, 0, 3) !== 'WIN') die('skip this test is for Windows platforms only');
|
|
?>
|
|
--INI--
|
|
opcache.enable_cli=1
|
|
opcache.optimization_level=-1
|
|
opcache.file_cache={TMP}
|
|
opcache.file_cache_only=1
|
|
--FILE--
|
|
<?php
|
|
$tmpdir = sys_get_temp_dir();
|
|
$pattern = $tmpdir . '/*/*/' . str_replace(':', '', __DIR__) . '/bug78189.php.bin';
|
|
$filenames = glob($pattern);
|
|
if (count($filenames)) {
|
|
foreach ($filenames as $filename) {
|
|
$part = substr($filename, strlen($tmpdir), 34);
|
|
if (!preg_match('~/[0-9a-f]{32}/~', $part)) {
|
|
echo "invalid opcache folder: $part\n";
|
|
}
|
|
}
|
|
} else {
|
|
echo "no opcache file found!\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|