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