Skip to content

Commit be559e6

Browse files
committed
Fix brittle test
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.
1 parent a149f9f commit be559e6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ext/opcache/tests/bug78189.phpt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ opcache.file_cache_only=1
1414
<?php
1515
$tmpdir = sys_get_temp_dir();
1616
$pattern = $tmpdir . '/*/*/' . str_replace(':', '', __DIR__) . '/bug78189.php.bin';
17-
foreach (glob($pattern) as $filename) {
18-
var_dump(preg_match('~/[0-9a-f]{32}/~', substr($filename, strlen($tmpdir), 34)));
17+
$filenames = glob($pattern);
18+
if (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";
1927
}
2028
?>
2129
--EXPECT--
22-
int(1)

0 commit comments

Comments
 (0)