Merge commit '06a9c98'

# Conflicts:
#	resources/vanilla
This commit is contained in:
Dylan K. Taylor 2020-04-18 13:48:26 +01:00
commit d4594d6114
2 changed files with 14 additions and 8 deletions

View File

@ -103,10 +103,11 @@ class CrashDump{
mkdir($this->server->getDataPath() . "crashdumps"); mkdir($this->server->getDataPath() . "crashdumps");
} }
$this->path = $this->server->getDataPath() . "crashdumps/" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log"; $this->path = $this->server->getDataPath() . "crashdumps/" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
$this->fp = @fopen($this->path, "wb"); $fp = @fopen($this->path, "wb");
if(!is_resource($this->fp)){ if(!is_resource($fp)){
throw new \RuntimeException("Could not create Crash Dump"); throw new \RuntimeException("Could not create Crash Dump");
} }
$this->fp = $fp;
$this->data["format_version"] = self::FORMAT_VERSION; $this->data["format_version"] = self::FORMAT_VERSION;
$this->data["time"] = $this->time; $this->data["time"] = $this->time;
$this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time)); $this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
@ -211,7 +212,10 @@ class CrashDump{
if(isset($lastExceptionError)){ if(isset($lastExceptionError)){
$error = $lastExceptionError; $error = $lastExceptionError;
}else{ }else{
$error = (array) error_get_last(); $error = error_get_last();
if($error === null){
throw new \RuntimeException("Crash error information missing - did something use exit()?");
}
$error["trace"] = Utils::currentTrace(3); //Skipping CrashDump->baseCrash, CrashDump->construct, Server->crashDump $error["trace"] = Utils::currentTrace(3); //Skipping CrashDump->baseCrash, CrashDump->construct, Server->crashDump
$error["fullFile"] = $error["file"]; $error["fullFile"] = $error["file"];
$error["file"] = Filesystem::cleanPath($error["file"]); $error["file"] = Filesystem::cleanPath($error["file"]);
@ -258,9 +262,11 @@ class CrashDump{
if($this->server->getProperty("auto-report.send-code", true) !== false and file_exists($error["fullFile"])){ if($this->server->getProperty("auto-report.send-code", true) !== false and file_exists($error["fullFile"])){
$file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES); $file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES);
for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10 and isset($file[$l]); ++$l){ if($file !== false){
$this->addLine("[" . ($l + 1) . "] " . $file[$l]); for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10 and isset($file[$l]); ++$l){
$this->data["code"][$l + 1] = $file[$l]; $this->addLine("[" . ($l + 1) . "] " . $file[$l]);
$this->data["code"][$l + 1] = $file[$l];
}
} }
} }

View File

@ -406,8 +406,8 @@ class MemoryManager{
"properties" => [] "properties" => []
]; ];
if($reflection->getParentClass()){ if(($parent = $reflection->getParentClass()) !== false){
$info["parent"] = $reflection->getParentClass()->getName(); $info["parent"] = $parent->getName();
} }
if(count($reflection->getInterfaceNames()) > 0){ if(count($reflection->getInterfaceNames()) > 0){