xref: /PHP-8.4/ext/standard/tests/file/006_basic.phpt (revision b5c7a83d)
1--TEST--
2Test fileperms() & chmod() functions: basic functionality
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip Not on Windows');
7}
8require __DIR__ . '/../skipif_root.inc';
9?>
10--FILE--
11<?php
12$path = __DIR__;
13
14echo "*** Testing fileperms(), chmod() with files and dirs ***\n";
15fopen($path."/perm.tmp", "w");
16var_dump( chmod($path."/perm.tmp", 0755 ) );
17printf("%o", fileperms($path."/perm.tmp") );
18echo "\n";
19clearstatcache();
20
21mkdir($path."/perm");
22var_dump( chmod( $path."/perm", 0777 ) );
23printf("%o", fileperms($path."/perm") );
24echo "\n";
25clearstatcache();
26
27echo "Done\n";
28?>
29--CLEAN--
30<?php
31unlink(__DIR__."/perm.tmp");
32rmdir(__DIR__."/perm");
33?>
34--EXPECT--
35*** Testing fileperms(), chmod() with files and dirs ***
36bool(true)
37100755
38bool(true)
3940777
40Done
41