mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Stop skipping stack frames (#425)
This commit is contained in:
parent
66fbfdd47b
commit
4c61ad9f2d
@ -143,7 +143,7 @@ class CrashDump{
|
|||||||
$error = $lastExceptionError;
|
$error = $lastExceptionError;
|
||||||
}else{
|
}else{
|
||||||
$error = (array) error_get_last();
|
$error = (array) error_get_last();
|
||||||
$error["trace"] = @getTrace(3);
|
$error["trace"] = getTrace(4); //Skipping CrashDump->baseCrash, CrashDump->construct, Server->crashDump
|
||||||
$errorConversion = [
|
$errorConversion = [
|
||||||
E_ERROR => "E_ERROR",
|
E_ERROR => "E_ERROR",
|
||||||
E_WARNING => "E_WARNING",
|
E_WARNING => "E_WARNING",
|
||||||
|
@ -357,7 +357,7 @@ namespace pocketmine {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTrace($start = 1, $trace = null){
|
function getTrace($start = 0, $trace = null){
|
||||||
if($trace === null){
|
if($trace === null){
|
||||||
if(function_exists("xdebug_get_function_stack")){
|
if(function_exists("xdebug_get_function_stack")){
|
||||||
$trace = array_reverse(xdebug_get_function_stack());
|
$trace = array_reverse(xdebug_get_function_stack());
|
||||||
|
@ -2027,9 +2027,8 @@ class Server{
|
|||||||
$errline = $e->getLine();
|
$errline = $e->getLine();
|
||||||
|
|
||||||
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? \LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? \LogLevel::WARNING : \LogLevel::NOTICE);
|
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? \LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? \LogLevel::WARNING : \LogLevel::NOTICE);
|
||||||
if(($pos = strpos($errstr, "\n")) !== false){
|
|
||||||
$errstr = substr($errstr, 0, $pos);
|
$errstr = preg_replace('/\s+/', ' ', trim($errstr));
|
||||||
}
|
|
||||||
|
|
||||||
$errfile = cleanPath($errfile);
|
$errfile = cleanPath($errfile);
|
||||||
|
|
||||||
@ -2041,7 +2040,7 @@ class Server{
|
|||||||
"fullFile" => $e->getFile(),
|
"fullFile" => $e->getFile(),
|
||||||
"file" => $errfile,
|
"file" => $errfile,
|
||||||
"line" => $errline,
|
"line" => $errline,
|
||||||
"trace" => @getTrace(1, $trace)
|
"trace" => getTrace(0, $trace)
|
||||||
];
|
];
|
||||||
|
|
||||||
global $lastExceptionError, $lastError;
|
global $lastExceptionError, $lastError;
|
||||||
|
@ -134,12 +134,10 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? LogLevel::WARNING : LogLevel::NOTICE);
|
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? LogLevel::WARNING : LogLevel::NOTICE);
|
||||||
}
|
}
|
||||||
$errno = $errorConversion[$errno] ?? $errno;
|
$errno = $errorConversion[$errno] ?? $errno;
|
||||||
if(($pos = strpos($errstr, "\n")) !== false){
|
$errstr = preg_replace('/\s+/', ' ', trim($errstr));
|
||||||
$errstr = substr($errstr, 0, $pos);
|
|
||||||
}
|
|
||||||
$errfile = \pocketmine\cleanPath($errfile);
|
$errfile = \pocketmine\cleanPath($errfile);
|
||||||
$this->log($type, get_class($e) . ": \"$errstr\" ($errno) in \"$errfile\" at line $errline");
|
$this->log($type, get_class($e) . ": \"$errstr\" ($errno) in \"$errfile\" at line $errline");
|
||||||
foreach(@\pocketmine\getTrace(1, $trace) as $i => $line){
|
foreach(\pocketmine\getTrace(0, $trace) as $i => $line){
|
||||||
$this->debug($line);
|
$this->debug($line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user