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.
This commit is contained in:
Nikita Popov 2019-02-19 16:15:01 +01:00
parent 12edc453e5
commit f5872614d8

View file

@ -2,10 +2,12 @@
Bug #42364 (Crash when using getRealPath with DirectoryIterator) Bug #42364 (Crash when using getRealPath with DirectoryIterator)
--FILE-- --FILE--
<?php <?php
$it = new DirectoryIterator(dirname(__FILE__)); $dir = __DIR__ . '/bug42364';
@mkdir($dir);
touch($dir . '/test');
$count = 0; $count = 0;
$it = new DirectoryIterator($dir);
foreach ($it as $e) { foreach ($it as $e) {
$count++; $count++;
$type = gettype($e->getRealPath()); $type = gettype($e->getRealPath());
@ -19,6 +21,8 @@ if ($count > 0) {
} }
?> ?>
===DONE=== ===DONE===
--CLEAN--
<?php rmdir(__DIR__ . '/bug42364'); ?>
--EXPECTF-- --EXPECTF--
Found %i entries! Found %i entries!
===DONE=== ===DONE===