diff --git a/lib/common.class.php b/lib/common.class.php
index 7eca7a5a6..b66f0ac8c 100644
--- a/lib/common.class.php
+++ b/lib/common.class.php
@@ -990,17 +990,15 @@ function checkAccess($object_type, $object_id)
function registerError($code = 'custom', $details = '')
{
- DebMes("Error registered (type: $code): ".$details);
+ $e = new \Exception;
+ $backtrace=$e->getTraceAsString();
+
+ DebMes("Error registered (type: $code):\n".$details."\nBacktrace:\n".$backtrace,'error');
$code = trim($code);
if ($code == 'sql') {
return 0;
}
-
- if (!$code)
- {
- $code = 'custom';
- }
$error_rec = SQLSelectOne("SELECT * FROM system_errors WHERE CODE LIKE '" . DBSafe($code) . "'");
@@ -1012,13 +1010,12 @@ function registerError($code = 'custom', $details = '')
}
$error_rec['LATEST_UPDATE'] = date('Y-m-d H:i:s');
- $error_rec['ACTIVE'] = (int)$error_rec['ACTIVE'] + 1;
+ @$error_rec['ACTIVE'] = (int)$error_rec['ACTIVE'] + 1;
SQLUpdate('system_errors', $error_rec);
$history_rec = array();
-
$history_rec['ERROR_ID'] = $error_rec['ID'];
- $history_rec['COMMENTS'] = $details;
+ $history_rec['COMMENTS'] = $details."\nBacktrace:\n".$backtrace;
$history_rec['ADDED'] = $error_rec['LATEST_UPDATE'];
//Temporary disabled
@@ -1031,7 +1028,6 @@ function registerError($code = 'custom', $details = '')
$history_rec['EVENTS_DATA'] = getURL($xrayUrl . 'events', 0);
$history_rec['DEBUG_DATA'] = getURL($xrayUrl . 'debmes', 0);
*/
-
$history_rec['ID'] = SQLInsert('system_errors_data', $history_rec);
if (!$error_rec['KEEP_HISTORY'])
diff --git a/lib/errors.class.php b/lib/errors.class.php
index 583d5ced7..318e6db77 100644
--- a/lib/errors.class.php
+++ b/lib/errors.class.php
@@ -39,67 +39,49 @@ class custom_error
* @param int $short Short (default 0)
* @return void
*/
- public function __construct($description, $stop = 0, $short = 0)
+ public function __construct($description, $stop = 0)
{
$script = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
- $description = $script . "\nError:\n" . $description;
- //$log = getLogger($this);
- //$log->error($description);
- //$backtrace=debug_backtrace();
- //print_r($backtrace);exit;
- DebMes($description.' ('.__FILE__.')');
-
- if (defined("DEBUG_MODE"))
- {
- if (!$short)
- {
- $this->alert(nl2br($description));
- }
- else
- {
- echo nl2br($description);
- }
+ if (!mb_detect_encoding($description, 'UTF-8', true)) {
+ $description = iconv('windows-1251','UTF-8',$description);
}
- else
- {
- if (!$short)
- {
- $this->alert("");
- }
- else
- {
- echo "Warning...
";
- }
+
+ $e = new \Exception;
+ if (defined("DEBUG_MODE")) {
+ $content=<<
+
+ Error
+
+
+
+
+
+
+
+
+
+
Error
+
Details
+
$script
$description
+
Backtrace
+
+
+
+
+