diff --git a/hphp/runtime/ext/ext_file.cpp b/hphp/runtime/ext/ext_file.cpp index ba4c5b498..5fe458f03 100644 --- a/hphp/runtime/ext/ext_file.cpp +++ b/hphp/runtime/ext/ext_file.cpp @@ -742,6 +742,9 @@ bool f_is_file(CStrRef filename) { bool f_is_dir(CStrRef filename) { String cwd; + if (filename.empty()) { + return false; + } bool isRelative = (filename.charAt(0) != '/'); if (isRelative) cwd = g_context->getCwd(); if (!isRelative || cwd == RuntimeOption::SourceRoot.c_str()) { diff --git a/hphp/test/quick/is_dir.php b/hphp/test/quick/is_dir.php new file mode 100644 index 000000000..32c2bc5a8 --- /dev/null +++ b/hphp/test/quick/is_dir.php @@ -0,0 +1,6 @@ +