bool CmdEval::onServer(DebuggerProxy &proxy) { PCFilter* locSave = g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = new PCFilter(); g_vmContext->setDebuggerBypassCheck(m_bypassAccessCheck); DebuggerProxy::ExecutePHP(m_body, m_output, !proxy.isLocal(), m_frame); g_vmContext->setDebuggerBypassCheck(false); delete g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = locSave; return proxy.sendToClient(this); }
// NB: unlike most other commands, the client expects that more interrupts // can occur while we're doing the server-side work for an eval. bool CmdEval::onServer(DebuggerProxy &proxy) { PCFilter* locSave = g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = new PCFilter(); g_vmContext->setDebuggerBypassCheck(m_bypassAccessCheck); proxy.ExecutePHP(m_body, m_output, m_frame, m_failed, DebuggerProxy::ExecutePHPFlagsAtInterrupt | (!proxy.isLocal() ? DebuggerProxy::ExecutePHPFlagsLog : DebuggerProxy::ExecutePHPFlagsNone)); g_vmContext->setDebuggerBypassCheck(false); delete g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = locSave; return proxy.sendToClient(this); }
// NB: unlike most other commands, the client expects that more interrupts // can occur while we're doing the server-side work for an eval. bool CmdEval::onServer(DebuggerProxy &proxy) { PCFilter locSave; RequestInjectionData &rid = ThreadInfo::s_threadInfo->m_reqInjectionData; locSave.swap(rid.m_flowFilter); g_context->debuggerSettings.bypassCheck = m_bypassAccessCheck; proxy.ExecutePHP(m_body, m_output, m_frame, m_failed, DebuggerProxy::ExecutePHPFlagsAtInterrupt | (!proxy.isLocal() ? DebuggerProxy::ExecutePHPFlagsLog : DebuggerProxy::ExecutePHPFlagsNone)); g_context->debuggerSettings.bypassCheck = false; locSave.swap(rid.m_flowFilter); return proxy.sendToClient(this); }
bool CmdPrint::onServer(DebuggerProxy &proxy) { PCFilter* locSave = g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = new PCFilter(); g_vmContext->setDebuggerBypassCheck(m_bypassAccessCheck); { EvalBreakControl eval(m_noBreak); m_ret = DebuggerProxy::ExecutePHP(DebuggerProxy::MakePHPReturn(m_body), m_output, !proxy.isLocal(), m_frame); } g_vmContext->setDebuggerBypassCheck(false); delete g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = locSave; return proxy.sendToClient(this); }
// Tries to read the contents of the file whose path is specified in m_file. // If the path cannot be resolved and is relative, the path of the sandbox // is used to qualify the relative path. If the contents cannot be retrieved // m_code will be an empty string. // The function returns false if the reply to the client fails during the // sending process. bool CmdList::onServer(DebuggerProxy &proxy) { auto savedWarningFrequency = RuntimeOption::WarningFrequency; RuntimeOption::WarningFrequency = 0; m_code = f_file_get_contents(m_file.c_str()); if (!proxy.isLocal() && !m_code.toBoolean() && m_file[0] != '/') { DSandboxInfo info = proxy.getSandbox(); if (info.m_path.empty()) { raise_warning("path for sandbox %s is not setup, run a web request", info.desc().c_str()); } else { std::string full_path = info.m_path + m_file; m_code = f_file_get_contents(full_path.c_str()); } } RuntimeOption::WarningFrequency = savedWarningFrequency; if (!m_code.toBoolean() && m_file == "systemlib.php") { m_code = SystemLib::s_source; } return proxy.sendToClient((DebuggerCommand*)this); }