]> granicus.if.org Git - php/commitdiff
Properly clean up test case
authorChristoph M. Becker <cmbecker69@gmx.de>
Fri, 22 Feb 2019 08:43:12 +0000 (09:43 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 22 Feb 2019 08:43:12 +0000 (09:43 +0100)
If we had to create an initial $start directory, we should remove it
at the end of the test.

ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt

index 5cc697c0fcaa463183548bfb1a37eb279d6639c1..9dc7cf3cc4e6337f3339f55b2685940ae36b7f5e 100644 (file)
@@ -24,9 +24,11 @@ for ($i = 0; $i < $how_many; $i++) {
 }
 
 $start = realpath(dirname(__FILE__));
+$newstart = false;
 if (strlen($start) <= 248) {
        // create the exact length
        $start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1);
+       $newstart = true;
 }
 
 var_dump($start);
@@ -47,6 +49,9 @@ for ($i = 0; $i < $how_many; $i++) {
        $p0 = substr($p, 0, strlen($p) - $i*51);
        rmdir($p0);
 }
+if ($newstart) {
+       rmdir($start);
+}
 
 ?>
 ===DONE===