Annotation of embedaddon/php/ext/standard/tests/file/chmod_variation2-win32.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: chmod() with various paths
                      3: --SKIPIF--
                      4: <?php
                      5: if (substr(PHP_OS, 0, 3) != 'WIN') {
                      6:     die('skip Windows only chmod test');
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: 
                     12: define("PERMISSIONS_MASK", 0777);
                     13: 
                     14: $script_directory = dirname(__FILE__);
                     15: chdir($script_directory);
                     16: $test_dirname = basename(__FILE__, ".php") . "testdir";
                     17: mkdir($test_dirname);
                     18: 
                     19: $filepath = __FILE__ . ".tmp";
                     20: $filename = basename($filepath);
                     21: $fd = fopen($filepath, "w+");
                     22: fclose($fd);
                     23: 
                     24: echo "chmod() on a path containing .. and .\n";
                     25: var_dump(chmod("./$test_dirname/../$filename", 0777));
                     26: var_dump(chmod("./$test_dirname/../$filename", 0755));
                     27: clearstatcache();
                     28: printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
                     29: 
                     30: echo "\nchmod() on a path containing .. with invalid directories\n";
                     31: var_dump(chmod($filepath, 0777));
                     32: var_dump(chmod("./$test_dirname/bad_dir/../../$filename", 0755));
                     33: clearstatcache();
                     34: printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
                     35:  
                     36: echo "\nchmod() on a relative path from a different working directory\n";
                     37: chdir($test_dirname);
                     38: var_dump(chmod("../$filename", 0777));
                     39: var_dump(chmod("../$filename", 0755));
                     40: clearstatcache();
                     41: printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
                     42: chdir($script_directory);
                     43: 
                     44: echo "\nchmod() on a directory with a trailing /\n";
                     45: var_dump(chmod($test_dirname, 0777));
                     46: var_dump(chmod("$test_dirname/", 0775));
                     47: clearstatcache();
                     48: printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
                     49: 
                     50: chdir($script_directory);
                     51: rmdir($test_dirname);
                     52: unlink($filepath);
                     53: 
                     54: ?>
                     55: --EXPECTF--
                     56: chmod() on a path containing .. and .
                     57: bool(true)
                     58: bool(true)
                     59: 666
                     60: 
                     61: chmod() on a path containing .. with invalid directories
                     62: bool(true)
                     63: bool(true)
                     64: 666
                     65: 
                     66: chmod() on a relative path from a different working directory
                     67: bool(true)
                     68: bool(true)
                     69: 666
                     70: 
                     71: chmod() on a directory with a trailing /
                     72: bool(true)
                     73: bool(true)
                     74: 666

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>