Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor
2022-03-28 17:18:54 +01:00
9 changed files with 66 additions and 69 deletions

View File

@ -44,10 +44,11 @@ final class CrashDumpRenderer{
$this->addLine($this->data->general->name . " Crash Dump " . date("D M j H:i:s T Y", (int) $this->data->time));
$this->addLine();
$this->addLine("Error: " . $this->data->error["message"]);
$this->addLine("File: " . $this->data->error["file"]);
$this->addLine("Line: " . $this->data->error["line"]);
$this->addLine("Type: " . $this->data->error["type"]);
$version = new VersionString($this->data->general->base_version, $this->data->general->is_dev, $this->data->general->build);
$this->addLine($this->data->general->name . " version: " . $version->getFullVersion(true) . " [Protocol " . $this->data->general->protocol . "]");
$this->addLine("Git commit: " . $this->data->general->git);
$this->addLine("PHP version: " . $this->data->general->php);
$this->addLine("OS: " . $this->data->general->php_os . ", " . $this->data->general->os);
if($this->data->plugin_involvement !== CrashDump::PLUGIN_INVOLVEMENT_NONE){
$this->addLine();
@ -62,30 +63,21 @@ final class CrashDumpRenderer{
}
$this->addLine();
$this->addLine("Code:");
foreach($this->data->code as $lineNumber => $line){
$this->addLine("[$lineNumber] $line");
}
$this->addLine();
$this->addLine("Error: " . $this->data->error["message"]);
$this->addLine("File: " . $this->data->error["file"]);
$this->addLine("Line: " . $this->data->error["line"]);
$this->addLine("Type: " . $this->data->error["type"]);
$this->addLine("Backtrace:");
foreach($this->data->trace as $line){
$this->addLine($line);
}
$this->addLine();
$this->addLine("Code:");
$version = new VersionString($this->data->general->base_version, $this->data->general->is_dev, $this->data->general->build);
$this->addLine($this->data->general->name . " version: " . $version->getFullVersion(true) . " [Protocol " . $this->data->general->protocol . "]");
$this->addLine("Git commit: " . $this->data->general->git);
$this->addLine("uname -a: " . $this->data->general->uname);
$this->addLine("PHP Version: " . $this->data->general->php);
$this->addLine("Zend version: " . $this->data->general->zend);
$this->addLine("OS: " . $this->data->general->php_os . ", " . $this->data->general->os);
$this->addLine("Composer libraries: ");
foreach(Utils::stringifyKeys($this->data->general->composer_libraries) as $library => $libraryVersion){
$this->addLine("- $library $libraryVersion");
foreach($this->data->code as $lineNumber => $line){
$this->addLine("[$lineNumber] $line");
}
if(count($this->data->plugins) > 0){
@ -95,6 +87,14 @@ final class CrashDumpRenderer{
$this->addLine($p->name . " " . $p->version . " by " . implode(", ", $p->authors) . " for API(s) " . implode(", ", $p->api));
}
}
$this->addLine();
$this->addLine("uname -a: " . $this->data->general->uname);
$this->addLine("Zend version: " . $this->data->general->zend);
$this->addLine("Composer libraries: ");
foreach(Utils::stringifyKeys($this->data->general->composer_libraries) as $library => $libraryVersion){
$this->addLine("- $library $libraryVersion");
}
}
public function addLine(string $line = "") : void{

View File

@ -335,12 +335,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$this->callDummyItemHeldEvent();
}
},
function(Inventory $unused, array $changedSlots) : void{
function() : void{
$this->setUsingItem(false);
$heldSlot = $this->inventory->getHeldItemIndex();
if(isset($changedSlots[$heldSlot])){
$this->callDummyItemHeldEvent();
}
$this->callDummyItemHeldEvent();
}
));

View File

@ -64,6 +64,9 @@ class ThreadManager extends \Volatile{
*/
public function getAll() : array{
$array = [];
/**
* @var Worker|Thread $thread
*/
foreach($this as $key => $thread){
$array[$key] = $thread;
}

View File

@ -32,7 +32,6 @@ use function curl_getinfo;
use function curl_init;
use function curl_setopt_array;
use function explode;
use function is_int;
use function is_string;
use function preg_match;
use function socket_close;
@ -220,7 +219,6 @@ class Internet{
}
if(!is_string($raw)) throw new AssumptionFailedError("curl_exec() should return string|false when CURLOPT_RETURNTRANSFER is set");
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(!is_int($httpCode)) throw new AssumptionFailedError("curl_getinfo(CURLINFO_HTTP_CODE) always returns int");
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$rawHeaders = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);