本文整理汇总了PHP中CError::openInIDE方法的典型用法代码示例。如果您正苦于以下问题:PHP CError::openInIDE方法的具体用法?PHP CError::openInIDE怎么用?PHP CError::openInIDE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CError
的用法示例。
在下文中一共展示了CError::openInIDE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exceptionHandler
/**
* Custom exception handler with backtrace
*
* @param exception $exception Thrown exception
*
* @return void
*/
function exceptionHandler($exception)
{
global $dPconfig;
$time = date("Y-m-d H:i:s");
// User information
$user_id = null;
$user_view = "";
if (class_exists("CAppUI", false) && CAppUI::$user) {
$user = CAppUI::$user;
if ($user->_id) {
$user_id = $user->_id;
$user_view = $user->_view;
}
}
// Server IP
$server_ip = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : null;
$file = mbRelativePath($exception->getFile());
$line = $exception->getLine();
$type = "exception";
$text = $exception->getMessage();
// Stacktrace
$contexts = $exception->getTrace();
foreach ($contexts as &$ctx) {
unset($ctx['args']);
}
// Might noy be ready at the time error is thrown
$session = isset($_SESSION) ? $_SESSION : array();
unset($session['AppUI']);
unset($session['dPcompteRendu']['templateManager']);
$_all_params = array("GET" => $_GET, "POST" => $_POST, "SESSION" => $session);
filterInput($_all_params);
// CApp might not be ready yet as of early error handling
$request_uid = null;
if (class_exists("CApp", false)) {
$request_uid = CApp::getRequestUID();
CApp::$performance[CError::$_categories["exception"]]++;
}
$build_output = ini_get("display_errors");
$save_to_file = false;
$data = array("stacktrace" => $contexts, "param_GET" => $_all_params["GET"], "param_POST" => $_all_params["POST"], "session_data" => $_all_params["SESSION"]);
if (@$dPconfig["error_logs_in_db"] && class_exists("CErrorLog")) {
try {
CErrorLog::insert($user_id, $server_ip, $time, $request_uid, $type, $text, $file, $line, $data);
} catch (Exception $e) {
$build_output = true;
$save_to_file = true;
}
} else {
$build_output = true;
$save_to_file = true;
}
if ($build_output) {
$hash = md5(serialize($contexts));
$html_class = "big-warning";
$log = "\n\n<div class='{$html_class}' title='{$hash}'>";
if ($user_id) {
$log .= "\n<strong>User: </strong>{$user_view} ({$user_id})";
}
$file = CError::openInIDE($file, $line);
$log .= <<<HTML
<strong>Time: </strong>{$time}
<strong>Type: </strong>{$type}
<strong>Text: </strong>{$text}
<strong>File: </strong>{$file}
<strong>Line: </strong>{$line}
HTML;
foreach ($_all_params as $_type => $_params) {
$log .= print_infos($_all_params[$_type], $_type);
}
foreach ($contexts as $context) {
$function = isset($context["class"]) ? $context["class"] . ":" : "";
$function .= $context["function"] . "()";
$log .= "\n<strong>Function: </strong> {$function}";
if (isset($context["file"])) {
$log .= "\n<strong>File: </strong>" . CError::openInIDE($context["file"], isset($context["line"]) ? $context["line"] : null);
}
if (isset($context["line"])) {
$log .= "\n<strong>Line: </strong>" . $context["line"];
}
$log .= "<br />";
}
$log .= "</div>";
if ($save_to_file) {
file_put_contents(LOG_PATH, $log, FILE_APPEND);
}
if (ini_get("display_errors")) {
echo $log;
}
}
}