com php-src: Make ext/spl/tests/bug42364.phpt more robust: ext/spl/tests/bug42364.phpt
| From: | Nikita Popov | Date: | Wed, 20 Feb 2019 10:19:55 +0000 |
| Subject: | com php-src: Make ext/spl/tests/bug42364.phpt more robust: ext/spl/tests/bug42364.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104770@lists.php.net to get a copy of this message | ||
Commit: f5872614d87c120e64b94fe1686005da9f53bc2d
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 19 Feb 2019 16:15:01 +0100
Parents: 12edc453e5cfed69ee150c1c19466dfe52026f94
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f5872614d87c120e64b94fe1686005da9f53bc2d
Log:
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.
Bugs:
https://bugs.php.net/42364
Changed paths:
M ext/spl/tests/bug42364.phpt
Diff:
diff --git a/ext/spl/tests/bug42364.phpt b/ext/spl/tests/bug42364.phpt
index 971fcc5..139af61 100644
--- a/ext/spl/tests/bug42364.phpt
+++ b/ext/spl/tests/bug42364.phpt
@@ -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===