diff --git a/hphp/runtime/ext/std/ext_std_file.cpp b/hphp/runtime/ext/std/ext_std_file.cpp index bb28b36cb92a75..e4357544757ecb 100644 --- a/hphp/runtime/ext/std/ext_std_file.cpp +++ b/hphp/runtime/ext/std/ext_std_file.cpp @@ -193,7 +193,15 @@ static int accessSyscall( return -1; } } - return ::access(File::TranslatePathWithFileCache(path).data(), mode); + String filepath = path; + if (path.charAt(0) != '/') { + String cwd = g_context->getCwd(); + filepath = cwd + "/" + path; + if (!cwd.empty() && cwd[cwd.length() - 1] == '/') { + filepath = cwd + path; + } + return ::access(filepath.data(),mode); + } } return w->access(uri_or_path, mode); } diff --git a/hphp/test/slow/file/relative_path.php b/hphp/test/slow/file/relative_path.php new file mode 100644 index 00000000000000..ebfbcf121abb48 --- /dev/null +++ b/hphp/test/slow/file/relative_path.php @@ -0,0 +1,9 @@ + diff --git a/hphp/test/slow/file/relative_path.php.expectf b/hphp/test/slow/file/relative_path.php.expectf new file mode 100644 index 00000000000000..5c0c0681d9c1e5 --- /dev/null +++ b/hphp/test/slow/file/relative_path.php.expectf @@ -0,0 +1 @@ +bool(false)