]> granicus.if.org Git - php/commitdiff
Avoid directory clash in realpath tests
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 12 Apr 2019 07:56:46 +0000 (09:56 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 12 Apr 2019 07:57:07 +0000 (09:57 +0200)
ext/standard/tests/file/realpath_basic3.phpt
ext/standard/tests/file/realpath_basic4.phpt

index 0feccfc150638d547f3e5438792f73c967798c82..622c1d6ccea839d0ab23db01ace43cc3854e2de7 100644 (file)
@@ -10,11 +10,11 @@ echo "\n*** Testing basic functions of realpath() with files ***\n";
 
 /* creating directories and files */
 $file_path = __DIR__;
-mkdir("$file_path/realpath_basic/home/test/", 0777, true);
+mkdir("$file_path/realpath_basic3/home/test/", 0777, true);
 
-$file_handle1 = fopen("$file_path/realpath_basic/home/test/realpath_basic.tmp", "w");
-$file_handle2 = fopen("$file_path/realpath_basic/home/realpath_basic.tmp", "w");
-$file_handle3 = fopen("$file_path/realpath_basic/realpath_basic.tmp", "w");
+$file_handle1 = fopen("$file_path/realpath_basic3/home/test/realpath_basic3.tmp", "w");
+$file_handle2 = fopen("$file_path/realpath_basic3/home/realpath_basic3.tmp", "w");
+$file_handle3 = fopen("$file_path/realpath_basic3/realpath_basic3.tmp", "w");
 fclose($file_handle1);
 fclose($file_handle2);
 fclose($file_handle3);
@@ -22,17 +22,17 @@ fclose($file_handle3);
 echo "\n*** Testing realpath() on filenames ***\n";
 $filenames = array (
   /* filenames resulting in valid paths */
-  "./realpath_basic/home/realpath_basic.tmp",
-  "./realpath_basic/realpath_basic.tmp",
-  "./realpath_basic//home/test//../test/./realpath_basic.tmp",
-  "./realpath_basic/home//../././realpath_basic.tmp",
+  "./realpath_basic3/home/realpath_basic3.tmp",
+  "./realpath_basic3/realpath_basic3.tmp",
+  "./realpath_basic3//home/test//../test/./realpath_basic3.tmp",
+  "./realpath_basic3/home//../././realpath_basic3.tmp",
 
   /* filenames with invalid path */
   // checking for binary safe
-  "./realpath_basicx000/home/realpath_basic.tmp",
+  "./realpath_basic3x000/home/realpath_basic3.tmp",
 
-  ".///realpath_basic/home//..//././test//realpath_basic.tmp",
-  "./realpath_basic/home/../home/../test/..realpath_basic.tmp"
+  ".///realpath_basic3/home//..//././test//realpath_basic3.tmp",
+  "./realpath_basic3/home/../home/../test/..realpath_basic3.tmp"
 );
 
 chdir("$file_path/..");
@@ -50,10 +50,10 @@ echo "Done\n";
 ?>
 --CLEAN--
 <?php
-$name_prefix = __DIR__."/realpath_basic";
-unlink("$name_prefix/home/test/realpath_basic.tmp");
-unlink("$name_prefix/home/realpath_basic.tmp");
-unlink("$name_prefix/realpath_basic.tmp");
+$name_prefix = __DIR__."/realpath_basic3";
+unlink("$name_prefix/home/test/realpath_basic3.tmp");
+unlink("$name_prefix/home/realpath_basic3.tmp");
+unlink("$name_prefix/realpath_basic3.tmp");
 rmdir("$name_prefix/home/test/");
 rmdir("$name_prefix/home/");
 rmdir("$name_prefix/");
@@ -64,16 +64,16 @@ rmdir("$name_prefix/");
 *** Testing realpath() on filenames ***
 
 -- Iteration 1 --
-string(%d) "%srealpath_basic%shome%srealpath_basic.tmp"
+string(%d) "%srealpath_basic3%shome%srealpath_basic3.tmp"
 
 -- Iteration 2 --
-string(%d) "%srealpath_basic%srealpath_basic.tmp"
+string(%d) "%srealpath_basic3%srealpath_basic3.tmp"
 
 -- Iteration 3 --
-string(%d) "%srealpath_basic%shome%stest%srealpath_basic.tmp"
+string(%d) "%srealpath_basic3%shome%stest%srealpath_basic3.tmp"
 
 -- Iteration 4 --
-string(%d) "%srealpath_basic%srealpath_basic.tmp"
+string(%d) "%srealpath_basic3%srealpath_basic3.tmp"
 
 -- Iteration 5 --
 bool(false)
index 9001e2355318cffcbeb4a3a068444c56dd852611..1af510d34a02b30526331e23b7deef78ae1f1e9a 100644 (file)
@@ -9,21 +9,21 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
 --FILE--
 <?php
 $file_path = __DIR__;
-@mkdir("$file_path/realpath_basic/home/test", 0777, true);
-@symlink("$file_path/realpath_basic/home", "$file_path/realpath_basic/link1");
-@symlink("$file_path/realpath_basic/link1", "$file_path/realpath_basic/link2");
-echo "1. " . realpath("$file_path/realpath_basic/link2") . "\n";
-echo "2. " . realpath("$file_path/realpath_basic/link2/test") . "\n";
+@mkdir("$file_path/realpath_basic4/home/test", 0777, true);
+@symlink("$file_path/realpath_basic4/home", "$file_path/realpath_basic4/link1");
+@symlink("$file_path/realpath_basic4/link1", "$file_path/realpath_basic4/link2");
+echo "1. " . realpath("$file_path/realpath_basic4/link2") . "\n";
+echo "2. " . realpath("$file_path/realpath_basic4/link2/test") . "\n";
 ?>
 --CLEAN--
 <?php
 $file_path = __DIR__;
-unlink("$file_path/realpath_basic/link2");
-unlink("$file_path/realpath_basic/link1");
-rmdir("$file_path/realpath_basic/home/test");
-rmdir("$file_path/realpath_basic/home");
-rmdir("$file_path/realpath_basic");
+unlink("$file_path/realpath_basic4/link2");
+unlink("$file_path/realpath_basic4/link1");
+rmdir("$file_path/realpath_basic4/home/test");
+rmdir("$file_path/realpath_basic4/home");
+rmdir("$file_path/realpath_basic4");
 ?>
 --EXPECTF--
-1. %s%erealpath_basic%ehome
-2. %s%erealpath_basic%ehome%etest
+1. %s%erealpath_basic4%ehome
+2. %s%erealpath_basic4%ehome%etest