fAccess = bucket->is_writable;
goto Finished;
}
- desired_access = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
+ desired_access = FILE_GENERIC_WRITE;
} else if(mode <= 4) {
if(bucket != NULL && bucket->is_rvalid) {
fAccess = bucket->is_readable;
else if(desired_access == FILE_GENERIC_WRITE) {
bucket->is_wvalid = 1;
bucket->is_writable = fAccess;
+ } else if (desired_access == FILE_GENERIC_READ | FILE_GENERIC_WRITE) {
+ bucket->is_rvalid = 1;
+ bucket->is_readable = fAccess;
+ bucket->is_wvalid = 1;
+ bucket->is_writable = fAccess;
}
}
$path = __DIR__ . '/a.txt';
foreach ($iteration as $perms => $exp) {
create_file($path, $perms);
+ clearstatcache(true, $path);
echo 'Iteration #' . $i++ . ': ';
if (is_writable($path) == $exp) {
echo "passed.\n";
$i = 1;
foreach ($iteration as $perms => $exp) {
create_file($path, $perms);
+ clearstatcache(true, $path);
echo 'Iteration #' . $i++ . ': ';
if (is_writable($path) == $exp) {
echo "passed.\n";
$path = __DIR__ . '/a.txt';
foreach ($iteration as $perms => $exp) {
create_file($path, $perms);
+ clearstatcache(true, $path);
echo 'Iteration #' . $i++ . ': ';
if (is_readable($path) == $exp) {
echo "passed.\n";
} else {
- var_dump(is_writable($path), $exp);
+ var_dump(is_readable($path), $exp);
echo "failed.\n";
}
delete_file($path);
$i = 1;
foreach ($iteration as $perms => $exp) {
create_file($path, $perms);
+ clearstatcache(true, $path);
echo 'Iteration #' . $i++ . ': ';
if (is_readable($path) == $exp) {
echo "passed.\n";
} else {
- var_dump(is_writable($path), $exp);
+ var_dump(is_readable($path), $exp);
echo "failed.\n";
}
delete_file($path);
--- /dev/null
+--TEST--\r
+bug #44859 (incorrect result with NTFS ACL permissions, is_readable)\r
+--CREDITS--\r
+Venkat Raman Don\r
+--SKIPIF--\r
+<?php \r
+include_once __DIR__ . '/common.inc';\r
+skipif();\r
+?>\r
+--FILE--\r
+<?php\r
+include_once __DIR__ . '/common.inc';\r
+\r
+$iteration = array(\r
+ PHPT_ACL_READ => true,\r
+ PHPT_ACL_NONE => false,\r
+ PHPT_ACL_WRITE => false,\r
+ PHPT_ACL_WRITE|PHPT_ACL_READ => true,\r
+);\r
+\r
+echo "Testing file with relative path:\n";\r
+$i = 1;\r
+$path = './a.txt';\r
+foreach ($iteration as $perms => $exp) {\r
+ create_file($path, $perms);\r
+ clearstatcache(true, $path);\r
+ echo 'Iteration #' . $i++ . ': ';\r
+ if (is_readable($path) == $exp) {\r
+ echo "passed.\n";\r
+ } else {\r
+ var_dump(is_readable($path), $exp);\r
+ echo "failed.\n";\r
+ }\r
+ delete_file($path);\r
+}\r
+\r
+echo "Testing directory with relative path:\n";\r
+$path = 'adir';\r
+$i = 1;\r
+foreach ($iteration as $perms => $exp) {\r
+ create_file($path, $perms);\r
+ clearstatcache(true, $path);\r
+ echo 'Iteration #' . $i++ . ': ';\r
+ if (is_readable($path) == $exp) {\r
+ echo "passed.\n";\r
+ } else {\r
+ var_dump(is_readable($path), $exp);\r
+ echo "failed.\n";\r
+ }\r
+ delete_file($path);\r
+}\r
+\r
+?>\r
+--EXPECT--\r
+Testing file with relative path:\r
+Iteration #1: passed.\r
+Iteration #2: passed.\r
+Iteration #3: passed.\r
+Iteration #4: passed.\r
+Testing directory with relative path:\r
+Iteration #1: passed.\r
+Iteration #2: passed.\r
+Iteration #3: passed.\r
+Iteration #4: passed.\r