From 01016e13c0b401c2d879dbdc6b963ee8f5318240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8=E9=83=A8=E8=90=BD?= Date: Thu, 23 Dec 2021 16:48:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20Exception=20=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=BB=A5=E5=8F=8A=E9=94=99=E8=AF=AF=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97,=20=E5=B9=B6=E8=B0=83=E6=95=B4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upload/source/class/discuz/discuz_error.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/upload/source/class/discuz/discuz_error.php b/upload/source/class/discuz/discuz_error.php index 3c6bae5b6..711971385 100644 --- a/upload/source/class/discuz/discuz_error.php +++ b/upload/source/class/discuz/discuz_error.php @@ -73,8 +73,7 @@ class discuz_error $error[line] = sprintf('%04d', $error['line']); $show .= "
  • [Line: $error[line]]".$file."($func)
  • "; - $log .= (!empty($log) ? ' -> ' : '').$file.':'.$error['line']; - $log .= $file.':'.$error['line']; + $logmsg .= '
    '.addslashes($file).'#'.addslashes($func).':'.$error['line']; } return array($show, $log); } @@ -139,6 +138,7 @@ class discuz_error krsort($trace); $trace[] = array('file'=>$exception->getFile(), 'line'=>$exception->getLine(), 'function'=> 'break'); + $logmsg = ''; $phpmsg = array(); foreach ($trace as $error) { if(!empty($error['function'])) { @@ -174,8 +174,17 @@ class discuz_error 'line' => $error['line'], 'function' => $error['function'], ); + $file = str_replace(array(DISCUZ_ROOT, '\\'), array('', '/'), $error['file']); + $func = isset($error['class']) ? $error['class'] : ''; + $func .= isset($error['type']) ? $error['type'] : ''; + $func .= isset($error['function']) ? $error['function'] : ''; + $line = sprintf('%04d', $error['line']); + $logmsg .= '
    '.addslashes($file).'#'.addslashes($func).':'.$line; } + $messagesave = ''.$errormsg.'
    PHP:'.$logmsg; + self::write_error_log($messagesave); + self::show_error($type, $errormsg, $phpmsg); exit(); -- Gitee