Skip to content

Commit f587261

Browse files
committed
Make ext/spl/tests/bug42364.phpt more robust
If tests are run in parallel, files may be created and deleted in the directory. Create a separate directory just for this test to avoid this dependence.
1 parent 12edc45 commit f587261

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ext/spl/tests/bug42364.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
Bug #42364 (Crash when using getRealPath with DirectoryIterator)
33
--FILE--
44
<?php
5-
$it = new DirectoryIterator(dirname(__FILE__));
5+
$dir = __DIR__ . '/bug42364';
6+
@mkdir($dir);
7+
touch($dir . '/test');
68

79
$count = 0;
8-
10+
$it = new DirectoryIterator($dir);
911
foreach ($it as $e) {
1012
$count++;
1113
$type = gettype($e->getRealPath());
@@ -19,6 +21,8 @@ if ($count > 0) {
1921
}
2022
?>
2123
===DONE===
24+
--CLEAN--
25+
<?php rmdir(__DIR__ . '/bug42364'); ?>
2226
--EXPECTF--
2327
Found %i entries!
2428
===DONE===

0 commit comments

Comments
 (0)