Annotation of embedaddon/php/ext/standard/tests/file/file_variation5-win32.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: file() with various paths
! 3: --SKIPIF--
! 4: <?php
! 5: if (substr(PHP_OS, 0, 3) != 'WIN') {
! 6: die('skip windows only test');
! 7: }
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11:
! 12: $script_directory = dirname(__FILE__);
! 13: chdir($script_directory);
! 14: $test_dirname = basename(__FILE__, ".php") . "testdir";
! 15: mkdir($test_dirname);
! 16:
! 17: $filepath = __FILE__ . ".tmp";
! 18: $filename = basename($filepath);
! 19: $fd = fopen($filepath, "w+");
! 20: fwrite($fd, "Line 1\nLine 2\nLine 3");
! 21: fclose($fd);
! 22:
! 23: echo "file() on a path containing .. and .\n";
! 24: var_dump(file("./$test_dirname/../$filename"));
! 25:
! 26: echo "\nfile() on a path containing .. with invalid directories\n";
! 27: var_dump(file("./$test_dirname/bad_dir/../../$filename"));
! 28:
! 29: echo "\nfile() on a relative path from a different working directory\n";
! 30: chdir($test_dirname);
! 31: var_dump(file("../$filename"));
! 32: chdir($script_directory);
! 33:
! 34: chdir($script_directory);
! 35: rmdir($test_dirname);
! 36: unlink($filepath);
! 37:
! 38: ?>
! 39: --EXPECT--
! 40: file() on a path containing .. and .
! 41: array(3) {
! 42: [0]=>
! 43: string(7) "Line 1
! 44: "
! 45: [1]=>
! 46: string(7) "Line 2
! 47: "
! 48: [2]=>
! 49: string(6) "Line 3"
! 50: }
! 51:
! 52: file() on a path containing .. with invalid directories
! 53: array(3) {
! 54: [0]=>
! 55: string(7) "Line 1
! 56: "
! 57: [1]=>
! 58: string(7) "Line 2
! 59: "
! 60: [2]=>
! 61: string(6) "Line 3"
! 62: }
! 63:
! 64: file() on a relative path from a different working directory
! 65: array(3) {
! 66: [0]=>
! 67: string(7) "Line 1
! 68: "
! 69: [1]=>
! 70: string(7) "Line 2
! 71: "
! 72: [2]=>
! 73: string(6) "Line 3"
! 74: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>