From b7457c8a04dace1b790dad66b710572ca5e7562e Mon Sep 17 00:00:00 2001 From: Paul Bissonnette Date: Thu, 31 Jan 2019 16:49:05 -0800 Subject: [PATCH] Use stream wrappers in FileUtil::runRelative Summary: In CLI server mode preludes need to be searched for in the context of the client process, as if they're only available visible from the client they should still be loadable. Reviewed By: alexeyt Differential Revision: D13892792 fbshipit-source-id: d3e2ac5c6776ac131ef94d87ac5d3e4bce61891d --- hphp/runtime/base/file-util-defs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hphp/runtime/base/file-util-defs.h b/hphp/runtime/base/file-util-defs.h index c2dcc8d0cc2..9cda50cd3ee 100644 --- a/hphp/runtime/base/file-util-defs.h +++ b/hphp/runtime/base/file-util-defs.h @@ -23,6 +23,7 @@ #include "hphp/runtime/base/stream-wrapper-registry.h" #include "hphp/runtime/base/unit-cache.h" #include "hphp/runtime/ext/std/ext_std_file.h" +#include "hphp/runtime/server/cli-server.h" #include "hphp/util/logger.h" #include @@ -123,7 +124,11 @@ bool runRelative(std::string suffix, String cmd, auto cwd = resolve_include( cmd, currentDir, - [] (const String& f, void*) { return access(f.data(), R_OK) == 0; }, + [] (const String& f, void*) { + if (!is_cli_mode()) return access(f.data(), R_OK) == 0; + auto const w = Stream::getWrapperFromURI(f, nullptr, false); + return w->access(f, R_OK) == 0; + }, nullptr ); if (cwd.isNull()) return false; -- 2.11.4.GIT