diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-12 09:56:46 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-12 09:57:07 +0200 |
commit | 0774d67ff958baa0ad08ae202c90a6553417d39a (patch) | |
tree | 37b68132145b98fec53d7c7863f3438963661116 /ext/standard | |
parent | 55cc280429c453a89e33de7357fa80589470dfc3 (diff) | |
download | php-git-0774d67ff958baa0ad08ae202c90a6553417d39a.tar.gz |
Avoid directory clash in realpath tests
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/tests/file/realpath_basic3.phpt | 38 | ||||
-rw-r--r-- | ext/standard/tests/file/realpath_basic4.phpt | 24 |
2 files changed, 31 insertions, 31 deletions
diff --git a/ext/standard/tests/file/realpath_basic3.phpt b/ext/standard/tests/file/realpath_basic3.phpt index 0feccfc150..622c1d6cce 100644 --- a/ext/standard/tests/file/realpath_basic3.phpt +++ b/ext/standard/tests/file/realpath_basic3.phpt @@ -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) diff --git a/ext/standard/tests/file/realpath_basic4.phpt b/ext/standard/tests/file/realpath_basic4.phpt index 9001e23553..1af510d34a 100644 --- a/ext/standard/tests/file/realpath_basic4.phpt +++ b/ext/standard/tests/file/realpath_basic4.phpt @@ -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 |