mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 23:45:34 +00:00
Fixed stack trace encoding bug in CrashDump
it was encoding the real (full) trace, instead of emitting the printable version.
This commit is contained in:
parent
0f545c410a
commit
e9d1af0aee
@ -44,6 +44,7 @@ use function implode;
|
|||||||
use function is_dir;
|
use function is_dir;
|
||||||
use function is_resource;
|
use function is_resource;
|
||||||
use function json_encode;
|
use function json_encode;
|
||||||
|
use function json_last_error_msg;
|
||||||
use function max;
|
use function max;
|
||||||
use function mkdir;
|
use function mkdir;
|
||||||
use function ob_end_clean;
|
use function ob_end_clean;
|
||||||
@ -146,7 +147,11 @@ class CrashDump{
|
|||||||
$this->addLine("----------------------REPORT THE DATA BELOW THIS LINE-----------------------");
|
$this->addLine("----------------------REPORT THE DATA BELOW THIS LINE-----------------------");
|
||||||
$this->addLine();
|
$this->addLine();
|
||||||
$this->addLine("===BEGIN CRASH DUMP===");
|
$this->addLine("===BEGIN CRASH DUMP===");
|
||||||
$this->encodedData = zlib_encode(json_encode($this->data, JSON_UNESCAPED_SLASHES), ZLIB_ENCODING_DEFLATE, 9);
|
$json = json_encode($this->data, JSON_UNESCAPED_SLASHES);
|
||||||
|
if($json === false){
|
||||||
|
throw new \RuntimeException("Failed to encode crashdump JSON: " . json_last_error_msg());
|
||||||
|
}
|
||||||
|
$this->encodedData = zlib_encode($json, ZLIB_ENCODING_DEFLATE, 9);
|
||||||
foreach(str_split(base64_encode($this->encodedData), 76) as $line){
|
foreach(str_split(base64_encode($this->encodedData), 76) as $line){
|
||||||
$this->addLine($line);
|
$this->addLine($line);
|
||||||
}
|
}
|
||||||
@ -238,6 +243,9 @@ class CrashDump{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($lastError)){
|
if(isset($lastError)){
|
||||||
|
if(isset($lastError["trace"])){
|
||||||
|
$lastError["trace"] = Utils::printableTrace($lastError["trace"]);
|
||||||
|
}
|
||||||
$this->data["lastError"] = $lastError;
|
$this->data["lastError"] = $lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user