Skip to content

Instantly share code, notes, and snippets.

@ptarjan
Created June 17, 2014 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptarjan/269d3450e60852133241 to your computer and use it in GitHub Desktop.
Save ptarjan/269d3450e60852133241 to your computer and use it in GitHub Desktop.
commit e4047dc130d0fe05efb989f448f5ebe1b7a3bd31
Author: Paul Tarjan <ptarjan@fb.com>
Date: 10 days ago
support display_errors
diff --git a/hphp/runtime/base/execution-context.cpp b/hphp/runtime/base/execution-context.cpp
index 2d83a46..07ae352 100644
--- a/hphp/runtime/base/execution-context.cpp
+++ b/hphp/runtime/base/execution-context.cpp
@@ -670,6 +670,11 @@ void ExecutionContext::handleError(const std::string& msg,
}
if (errorNeedsLogging(errnum)) {
+
+ if (ThreadInfo::s_threadInfo->m_reqInjectionData.hasDisplayErrors()) {
+ echo(msg);
+ }
+
DEBUGGER_ATTACHED_ONLY(phpDebuggerErrorHook(ee.getMessage()));
String file = empty_string();
int line = 0;
diff --git a/hphp/runtime/base/request-injection-data.cpp b/hphp/runtime/base/request-injection-data.cpp
index 1ed6ca4..60dfece 100644
--- a/hphp/runtime/base/request-injection-data.cpp
+++ b/hphp/runtime/base/request-injection-data.cpp
@@ -179,6 +179,9 @@ void RequestInjectionData::threadInit() {
.c_str(),
&m_errorReportingLevel);
IniSetting::Bind(IniSetting::CORE, IniSetting::PHP_INI_ALL,
+ "display_errors", "0",
+ &m_displayErrors);
+ IniSetting::Bind(IniSetting::CORE, IniSetting::PHP_INI_ALL,
"track_errors", "0",
&m_trackErrors);
IniSetting::Bind(IniSetting::CORE, IniSetting::PHP_INI_ALL,
diff --git a/hphp/runtime/base/request-injection-data.h b/hphp/runtime/base/request-injection-data.h
index 10a596b..9ba98d4 100644
--- a/hphp/runtime/base/request-injection-data.h
+++ b/hphp/runtime/base/request-injection-data.h
@@ -94,6 +94,7 @@ struct RequestInjectionData {
std::string m_defaultMimeType;
std::vector<std::string> m_include_paths;
int64_t m_errorReportingLevel;
+ bool m_displayErrors;
bool m_logErrors;
std::string m_errorLog;
bool m_trackErrors;
@@ -135,6 +136,7 @@ struct RequestInjectionData {
std::string getDefaultIncludePath();
int64_t getErrorReportingLevel() { return m_errorReportingLevel; }
void setErrorReportingLevel(int level) { m_errorReportingLevel = level; }
+ bool hasDisplayErrors() { return m_displayErrors; }
int64_t getSocketDefaultTimeout() const { return m_socketDefaultTimeout; }
std::vector<std::string> getAllowedDirectories() const {
return m_allowedDirectories;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment