summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-07-01 16:41:20 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-07-01 16:42:55 +0200
commitbe559e6c37e0618c5e3429c3bfd5223840d3654c (patch)
treed2d48763a8d3f3e892f420d8ce1c55ac94a87eb9
parenta149f9f3c087fb99dae217653d705aa4fc1d0c66 (diff)
downloadphp-git-be559e6c37e0618c5e3429c3bfd5223840d3654c.tar.gz
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.
-rw-r--r--ext/opcache/tests/bug78189.phpt13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/opcache/tests/bug78189.phpt b/ext/opcache/tests/bug78189.phpt
index 49891c8d63..d97d8e9470 100644
--- a/ext/opcache/tests/bug78189.phpt
+++ b/ext/opcache/tests/bug78189.phpt
@@ -14,9 +14,16 @@ opcache.file_cache_only=1
<?php
$tmpdir = sys_get_temp_dir();
$pattern = $tmpdir . '/*/*/' . str_replace(':', '', __DIR__) . '/bug78189.php.bin';
-foreach (glob($pattern) as $filename) {
- var_dump(preg_match('~/[0-9a-f]{32}/~', substr($filename, strlen($tmpdir), 34)));
+$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--
-int(1)