From 480a513f303f63c245093647ff7fedd170b78056 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 19 Jan 2019 16:42:22 +0000 Subject: [PATCH 1/3] Sign: fixed asserts on loading NBT, closes #2636 --- src/pocketmine/tile/Sign.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/tile/Sign.php b/src/pocketmine/tile/Sign.php index a7e0958c7..ca577ad93 100644 --- a/src/pocketmine/tile/Sign.php +++ b/src/pocketmine/tile/Sign.php @@ -31,8 +31,6 @@ use pocketmine\utils\TextFormat; use function array_map; use function array_pad; use function array_slice; -use function assert; -use function count; use function explode; use function implode; use function sprintf; @@ -41,13 +39,16 @@ class Sign extends Spawnable{ public const TAG_TEXT_BLOB = "Text"; public const TAG_TEXT_LINE = "Text%d"; //sprintf()able + private static function fixTextBlob(string $blob) : array{ + return array_slice(array_pad(explode("\n", $blob), 4, ""), 0, 4); + } + /** @var string[] */ protected $text = ["", "", "", ""]; protected function readSaveData(CompoundTag $nbt) : void{ if($nbt->hasTag(self::TAG_TEXT_BLOB, StringTag::class)){ //MCPE 1.2 save format - $this->text = array_pad(explode("\n", $nbt->getString(self::TAG_TEXT_BLOB)), 4, ""); - assert(count($this->text) === 4, "Too many lines!"); + $this->text = self::fixTextBlob($nbt->getString(self::TAG_TEXT_BLOB)); }else{ for($i = 1; $i <= 4; ++$i){ $textKey = sprintf(self::TAG_TEXT_LINE, $i); @@ -138,7 +139,7 @@ class Sign extends Spawnable{ } if($nbt->hasTag(self::TAG_TEXT_BLOB, StringTag::class)){ - $lines = array_slice(array_pad(explode("\n", $nbt->getString(self::TAG_TEXT_BLOB)), 4, ""), 0, 4); + $lines = self::fixTextBlob($nbt->getString(self::TAG_TEXT_BLOB)); }else{ return false; } From d4851a8f1f076856a25daafa6796f572c909a905 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 19 Jan 2019 17:33:07 +0000 Subject: [PATCH 2/3] Release 3.5.6 --- src/pocketmine/PocketMine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 62f6fdb84..54b58dfe8 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -38,7 +38,7 @@ namespace pocketmine { const NAME = "PocketMine-MP"; const BASE_VERSION = "3.5.6"; - const IS_DEVELOPMENT_BUILD = true; + const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0; const MIN_PHP_VERSION = "7.2.0"; From a6a93f822f47d229204d89d10ecde15441414785 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 19 Jan 2019 17:48:16 +0000 Subject: [PATCH 3/3] 3.5.7 is next --- src/pocketmine/PocketMine.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 54b58dfe8..3a06df7a9 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -37,8 +37,8 @@ namespace pocketmine { use pocketmine\wizard\SetupWizard; const NAME = "PocketMine-MP"; - const BASE_VERSION = "3.5.6"; - const IS_DEVELOPMENT_BUILD = false; + const BASE_VERSION = "3.5.7"; + const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0; const MIN_PHP_VERSION = "7.2.0";