1--TEST--
2chmod() basic fuctionality
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip non-windows only test');
7}
8?>
9--FILE--
10<?php
11
12define("MODE_MASK", 07777);
13
14$filename = __FILE__ . ".tmp";
15
16$fd = fopen($filename, "w+");
17fclose($fd);
18
19for ($perms_to_set = 07777; $perms_to_set >= 0; $perms_to_set--) {
20	chmod($filename, $perms_to_set);
21	$set_perms = (fileperms($filename) & MODE_MASK);
22	clearstatcache();
23	if ($set_perms != $perms_to_set) {
24		printf("Error: %o does not match %o\n", $set_perms, $perms_to_set);
25	}
26}
27var_dump(chmod($filename, 0777));
28
29unlink($filename);
30echo "done";
31
32?>
33--EXPECT--
34bool(true)
35done
36