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)
--FILE--
<?php
$it = new DirectoryIterator(dirname(__FILE__));
$dir = __DIR__ . '/bug42364';
@mkdir($dir);
touch($dir . '/test');
$count = 0;
$it = new DirectoryIterator($dir);
foreach ($it as $e) {
$count++;
$type = gettype($e->getRealPath());
@ -19,6 +21,8 @@ if ($count > 0) {
}
?>
===DONE===
--CLEAN--
<?php rmdir(__DIR__ . '/bug42364'); ?>
--EXPECTF--
Found %i entries!
===DONE===