diff options
author | Steve Seear <stevseea@php.net> | 2008-06-11 12:40:34 +0000 |
---|---|---|
committer | Steve Seear <stevseea@php.net> | 2008-06-11 12:40:34 +0000 |
commit | 79cb128c593626c00d765aff303f39074869b847 (patch) | |
tree | 4444b9a1588ca60feb961c6f3fa175868c5712ce /ext/standard/tests/file/chmod_variation2-win32.phpt | |
parent | c7d50cb478589b48aa014ac610b3fe628b7dbf57 (diff) | |
download | php-git-79cb128c593626c00d765aff303f39074869b847.tar.gz |
Filesystem tests.
Diffstat (limited to 'ext/standard/tests/file/chmod_variation2-win32.phpt')
-rw-r--r-- | ext/standard/tests/file/chmod_variation2-win32.phpt | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/ext/standard/tests/file/chmod_variation2-win32.phpt b/ext/standard/tests/file/chmod_variation2-win32.phpt new file mode 100644 index 0000000000..bc379ffcf7 --- /dev/null +++ b/ext/standard/tests/file/chmod_variation2-win32.phpt @@ -0,0 +1,74 @@ +--TEST-- +chmod() with various paths +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip Windows only chmod test'); +} +?> +--FILE-- +<?php + +define("PERMISSIONS_MASK", 0777); + +$script_directory = dirname(__FILE__); +chdir($script_directory); +$test_dirname = basename(__FILE__, ".php") . "testdir"; +mkdir($test_dirname); + +$filepath = __FILE__ . ".tmp"; +$filename = basename($filepath); +$fd = fopen($filepath, "w+"); +fclose($fd); + +echo "chmod() on a path containing .. and .\n"; +var_dump(chmod("./$test_dirname/../$filename", 0777)); +var_dump(chmod("./$test_dirname/../$filename", 0755)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); + +echo "\nchmod() on a path containing .. with invalid directories\n"; +var_dump(chmod($filepath, 0777)); +var_dump(chmod("./$test_dirname/bad_dir/../../$filename", 0755)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); + +echo "\nchmod() on a relative path from a different working directory\n"; +chdir($test_dirname); +var_dump(chmod("../$filename", 0777)); +var_dump(chmod("../$filename", 0755)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); +chdir($script_directory); + +echo "\nchmod() on a directory with a trailing /\n"; +var_dump(chmod($test_dirname, 0777)); +var_dump(chmod("$test_dirname/", 0775)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); + +chdir($script_directory); +rmdir($test_dirname); +unlink($filepath); + +?> +--EXPECTF-- +chmod() on a path containing .. and . +bool(true) +bool(true) +666 + +chmod() on a path containing .. with invalid directories +bool(true) +bool(true) +666 + +chmod() on a relative path from a different working directory +bool(true) +bool(true) +666 + +chmod() on a directory with a trailing / +bool(true) +bool(true) +666 |