1--TEST--
2bug #44859 (incorrect result with NTFS ACL permissions, is_writable)
3--SKIPIF--
4<?php
5include_once __DIR__ . '/common.inc';
6skipif();
7?>
8--FILE--
9<?php
10$uniqueBasePath = substr(__FILE__, 0, strrpos(__FILE__, '.'));
11include_once __DIR__ . '/common.inc';
12fix_acls();
13
14$iteration = array(
15    PHPT_ACL_READ => false,
16    PHPT_ACL_NONE => false,
17    PHPT_ACL_WRITE => true,
18    PHPT_ACL_WRITE|PHPT_ACL_READ => true,
19);
20
21echo "Testing file:\n";
22$i = 1;
23$path = $uniqueBasePath . '_file.txt';
24foreach ($iteration as $perms => $exp) {
25    create_file($path, $perms);
26    clearstatcache(true, $path);
27    echo 'Iteration #' . $i++ . ': ';
28    if (is_writable($path) == $exp) {
29        echo "passed.\n";
30    } else {
31        var_dump(is_writable($path), $exp);
32        echo "failed.\n";
33    }
34    delete_file($path);
35}
36
37echo "Testing directory:\n";
38$path = $uniqueBasePath . '_dir';
39$i = 1;
40foreach ($iteration as $perms => $exp) {
41    create_dir($path, $perms);
42    clearstatcache(true, $path);
43    echo 'Iteration #' . $i++ . ': ';
44    if (is_writable($path) == $exp) {
45        echo "passed.\n";
46    } else {
47        var_dump(is_writable($path), $exp);
48        echo "failed.\n";
49    }
50    delete_dir($path);
51}
52
53?>
54--EXPECT--
55Testing file:
56Iteration #1: passed.
57Iteration #2: passed.
58Iteration #3: passed.
59Iteration #4: passed.
60Testing directory:
61Iteration #1: passed.
62Iteration #2: passed.
63Iteration #3: passed.
64Iteration #4: passed.
65