1--TEST--
2chmod() on a directory
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("PERMISSIONS_MASK", 0777);
13
14$dirname = __DIR__ . "/" . basename(__FILE__, ".php") . "testdir";
15mkdir($dirname);
16
17for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) {
18    chmod($dirname, $perms_to_set);
19    $set_perms = (fileperms($dirname) & PERMISSIONS_MASK);
20    clearstatcache();
21    if ($set_perms != $perms_to_set) {
22        printf("Error: %o does not match %o\n", $set_perms, $perms_to_set);
23    }
24}
25
26var_dump(chmod($dirname, 0777));
27rmdir($dirname);
28
29echo "done";
30
31?>
32--EXPECT--
33bool(true)
34done
35