From 32ad9d0c1ac7dac5eca221f38b604dc70a331b15 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 22 Oct 2019 22:50:35 +0100 Subject: [PATCH 01/36] Squid: fix spammy rotation in enclosed spaces this bug was caused by 2f3c77c68a0d9e0fdfb0eb69bd44344f4c8d028d. It looks unrelated to the commit title, so it may have been committed by mistake. --- src/pocketmine/entity/Squid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/entity/Squid.php b/src/pocketmine/entity/Squid.php index 8592821af..abce81095 100644 --- a/src/pocketmine/entity/Squid.php +++ b/src/pocketmine/entity/Squid.php @@ -82,7 +82,7 @@ class Squid extends WaterAnimal{ return false; } - if(++$this->switchDirectionTicker === 100 or $this->isCollided){ + if(++$this->switchDirectionTicker === 100){ $this->switchDirectionTicker = 0; if(mt_rand(0, 100) < 50){ $this->swimDirection = null; From 9a51ba697a60701954a9f782241b60f3d90a192f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 24 Oct 2019 08:50:13 +0100 Subject: [PATCH 02/36] PocketMine.php: move some mission-critical stuff earlier in boot sequence fixes #3161 --- src/pocketmine/PocketMine.php | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 90292b77d..8b7a1efef 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -169,6 +169,32 @@ namespace pocketmine { set_time_limit(0); //Who set it to 30 seconds?!?! + $version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER); + define('pocketmine\VERSION', $version->getFullVersion(true)); + + $gitHash = str_repeat("00", 20); + + if(\Phar::running(true) === ""){ + if(Utils::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out = trim($out)) === 40){ + $gitHash = trim($out); + if(Utils::execute("git diff --quiet") === 1 or Utils::execute("git diff --cached --quiet") === 1){ //Locally-modified + $gitHash .= "-dirty"; + } + } + }else{ + $phar = new \Phar(\Phar::running(false)); + $meta = $phar->getMetadata(); + if(isset($meta["git"])){ + $gitHash = $meta["git"]; + } + } + + define('pocketmine\GIT_COMMIT', $gitHash); + + + @define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1); + @ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors + ini_set("allow_url_fopen", '1'); ini_set("display_errors", '1'); ini_set("display_startup_errors", '1'); @@ -233,32 +259,6 @@ namespace pocketmine { $logger->warning("Non-packaged " . \pocketmine\NAME . " installation detected. Consider using a phar in production for better performance."); } - $version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER); - define('pocketmine\VERSION', $version->getFullVersion(true)); - - $gitHash = str_repeat("00", 20); - - if(\Phar::running(true) === ""){ - if(Utils::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out = trim($out)) === 40){ - $gitHash = trim($out); - if(Utils::execute("git diff --quiet") === 1 or Utils::execute("git diff --cached --quiet") === 1){ //Locally-modified - $gitHash .= "-dirty"; - } - } - }else{ - $phar = new \Phar(\Phar::running(false)); - $meta = $phar->getMetadata(); - if(isset($meta["git"])){ - $gitHash = $meta["git"]; - } - } - - define('pocketmine\GIT_COMMIT', $gitHash); - - - @define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1); - @ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors - $exitCode = 0; do{ if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){ From 1163ac1d7abe3b51d3aa798ded873d9053817cd8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Aug 2019 17:39:57 +0100 Subject: [PATCH 03/36] backport 0c31b8731fe68bd56dbbfcc5eed77dedef914664: PocketMine.php: get rid of redundant LOCK_FILE_PATH constant --- src/pocketmine/PocketMine.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 8b7a1efef..94dba731d 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -213,8 +213,7 @@ namespace pocketmine { mkdir(\pocketmine\DATA, 0777, true); } - define('pocketmine\LOCK_FILE_PATH', \pocketmine\DATA . 'server.lock'); - define('pocketmine\LOCK_FILE', fopen(\pocketmine\LOCK_FILE_PATH, "a+b")); + define('pocketmine\LOCK_FILE', fopen(\pocketmine\DATA . 'server.lock', "a+b")); if(!flock(\pocketmine\LOCK_FILE, LOCK_EX | LOCK_NB)){ //wait for a shared lock to avoid race conditions if two servers started at the same time - this makes sure the //other server wrote its PID and released exclusive lock before we get our lock From 3e993250d8c591ebef6f7a72e776c474fd24fd5b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Aug 2019 17:48:13 +0100 Subject: [PATCH 04/36] backport 0c31b8731fe68bd56dbbfcc5eed77dedef914664: PocketMine.php: use main logger to emit force-kill debug --- src/pocketmine/PocketMine.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 94dba731d..bdd6fbb17 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -280,9 +280,7 @@ namespace pocketmine { usleep(10000); //Fixes ServerKiller not being able to start on single-core machines if(ThreadManager::getInstance()->stopAll() > 0){ - if(\pocketmine\DEBUG > 1){ - echo "Some threads could not be stopped, performing a force-kill" . PHP_EOL . PHP_EOL; - } + $logger->debug("Some threads could not be stopped, performing a force-kill"); Utils::kill(getmypid()); } }while(false); From 1815fe5b46ecccd97ccd1edc78dae0ca27f66988 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Aug 2019 16:14:35 +0100 Subject: [PATCH 05/36] backport 647f86a5b818c308e7fd690178c20099a836cfe9: PocketMine.php: remove redundant ini_set() this is overridden later on by MemoryManager. --- src/pocketmine/PocketMine.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index bdd6fbb17..fc688278a 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -200,8 +200,6 @@ namespace pocketmine { ini_set("display_startup_errors", '1'); ini_set("default_charset", "utf-8"); - ini_set("memory_limit", '-1'); - define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR); $opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]); From d6b99509019067cee3494468851a0ebab9a491cd Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Aug 2019 16:34:26 +0100 Subject: [PATCH 06/36] backport fdfbaf4e95d9760199b363005cca71b852d5eee5: make startup performance warnings a little more coherent --- src/pocketmine/PocketMine.php | 26 ++++++++++++++++---------- src/pocketmine/Server.php | 4 ---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index fc688278a..4b191b36b 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -121,6 +121,21 @@ namespace pocketmine { return $messages; } + function emit_performance_warnings(\Logger $logger){ + if(extension_loaded("xdebug")){ + $logger->warning("Xdebug extension is enabled. This has a major impact on performance."); + } + if(!extension_loaded("pocketmine_chunkutils")){ + $logger->warning("ChunkUtils extension is missing. Anvil-format worlds will experience degraded performance."); + } + if(((int) ini_get('zend.assertions')) !== -1){ + $logger->warning("Debugging assertions are enabled. This may degrade performance. To disable them, set `zend.assertions = -1` in php.ini."); + } + if(\Phar::running(true) === ""){ + $logger->warning("Non-packaged installation detected. This will degrade autoloading speed and make startup times longer."); + } + } + function server(){ if(!empty($messages = check_platform_dependencies())){ echo PHP_EOL; @@ -245,16 +260,7 @@ namespace pocketmine { } unset($tzError); - if(extension_loaded("xdebug")){ - $logger->warning(PHP_EOL . PHP_EOL . PHP_EOL . "\tYou are running " . \pocketmine\NAME . " with xdebug enabled. This has a major impact on performance." . PHP_EOL . PHP_EOL); - } - if(!extension_loaded("pocketmine_chunkutils")){ - $logger->warning("ChunkUtils extension is missing. Anvil-format worlds will experience degraded performance."); - } - - if(\Phar::running(true) === ""){ - $logger->warning("Non-packaged " . \pocketmine\NAME . " installation detected. Consider using a phar in production for better performance."); - } + emit_performance_warnings($logger); $exitCode = 0; do{ diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index e992a9a3e..100860de3 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1565,10 +1565,6 @@ class Server{ return; } - if(((int) ini_get('zend.assertions')) !== -1){ - $this->logger->warning("Debugging assertions are enabled, this may impact on performance. To disable them, set `zend.assertions = -1` in php.ini."); - } - ini_set('assert.exception', '1'); if($this->logger instanceof MainLogger){ From cc79dfa64cf05beb9d7de66c7ec4b5cbf1935c18 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Aug 2019 17:50:45 +0100 Subject: [PATCH 07/36] backport 8b40a8f21764008aa7b2a64788af2c77f238e219: PocketMine.php: move INI entry setting to a separate function --- src/pocketmine/PocketMine.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 4b191b36b..f5c503fdf 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -136,6 +136,14 @@ namespace pocketmine { } } + function set_ini_entries(){ + ini_set("allow_url_fopen", '1'); + ini_set("display_errors", '1'); + ini_set("display_startup_errors", '1'); + ini_set("default_charset", "utf-8"); + @ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors + } + function server(){ if(!empty($messages = check_platform_dependencies())){ echo PHP_EOL; @@ -208,12 +216,8 @@ namespace pocketmine { @define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1); - @ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors - ini_set("allow_url_fopen", '1'); - ini_set("display_errors", '1'); - ini_set("display_startup_errors", '1'); - ini_set("default_charset", "utf-8"); + set_ini_entries(); define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR); From c063a4da291bbf7eb0a8522938f2a29f092657b3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Aug 2019 18:18:14 +0100 Subject: [PATCH 08/36] backport 5c1f1f00cbbcc6460927b922f993f1de8e1e046c: move assert.exception to PocketMine.php with the other stuff --- src/pocketmine/PocketMine.php | 1 + src/pocketmine/Server.php | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index f5c503fdf..0d346f72b 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -142,6 +142,7 @@ namespace pocketmine { ini_set("display_startup_errors", '1'); ini_set("default_charset", "utf-8"); @ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors + ini_set('assert.exception', '1'); } function server(){ diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 100860de3..742bd2277 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1565,8 +1565,6 @@ class Server{ return; } - ini_set('assert.exception', '1'); - if($this->logger instanceof MainLogger){ $this->logger->setLogDebug(\pocketmine\DEBUG > 1); } From d3171d6a8eac1b546c1b6e89f73049f1e3462b1d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Aug 2019 19:41:53 +0100 Subject: [PATCH 09/36] backport a53f698d383fd06efe4fab516314fa22ad0f4ab0: PocketMine.php: remove useless set_time_limit() call this is hardcoded to zero in the PHP core anyway. --- src/pocketmine/PocketMine.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 0d346f72b..2f1524ab0 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -191,8 +191,6 @@ namespace pocketmine { $autoloader = new \BaseClassLoader(); $autoloader->register(false); - set_time_limit(0); //Who set it to 30 seconds?!?! - $version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER); define('pocketmine\VERSION', $version->getFullVersion(true)); From b216fb8910f573a61ee964ed22102b3d7384b9d4 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 24 Oct 2019 09:18:50 +0100 Subject: [PATCH 10/36] PocketMine.php: set INI entries as early as possible --- src/pocketmine/PocketMine.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 2f1524ab0..97446698b 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -160,6 +160,7 @@ namespace pocketmine { unset($messages); error_reporting(-1); + set_ini_entries(); if(\Phar::running(true) !== ""){ define('pocketmine\PATH', \Phar::running(true) . "/"); @@ -216,8 +217,6 @@ namespace pocketmine { @define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1); - set_ini_entries(); - define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR); $opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]); From 48080b7f90f531b0f1b3182b9231311b44e2182c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 24 Oct 2019 09:23:37 +0100 Subject: [PATCH 11/36] PocketMine.php: define INT32_MASK earlier this is non-dependent on any of the PM crap. --- src/pocketmine/PocketMine.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 97446698b..a17d9797c 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -161,6 +161,7 @@ namespace pocketmine { error_reporting(-1); set_ini_entries(); + @define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1); if(\Phar::running(true) !== ""){ define('pocketmine\PATH', \Phar::running(true) . "/"); @@ -214,9 +215,6 @@ namespace pocketmine { define('pocketmine\GIT_COMMIT', $gitHash); - - @define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1); - define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR); $opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]); From 86c78704273673e64534ae22be5d7486e3045e4e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 24 Oct 2019 13:28:27 +0100 Subject: [PATCH 12/36] update build/php submodule --- build/php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/php b/build/php index 1b3fe3120..8666ae5ad 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 1b3fe3120cac93ef8d821a1c62a3722576fcfd81 +Subproject commit 8666ae5add7a8b5213d68b491ebf0de211998cc9 From abbb8bbf559164a8261f18fe442315026533754b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 24 Oct 2019 13:37:24 +0100 Subject: [PATCH 13/36] travis.sh: allow latest phpunit v7 now that we have XML not ready to move to v8 yet because of BC breaks --- tests/travis.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/travis.sh b/tests/travis.sh index b0ccce1e8..049ec0526 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -21,9 +21,7 @@ if [ $? -ne 0 ]; then exit 1 fi -#Run PHPUnit tests -#7.5.12 introduces changes that set the build on fire because we don't ship libxml - TODO FIX -curl https://phar.phpunit.de/phpunit-7.5.11.phar --silent --location -o phpunit.phar +curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar "$PHP_BINARY" phpunit.phar --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit || exit 1 #Run-the-server tests From d1ca779c1a6d1bd537d5cb9c33e4cf9d229db8a7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 15:49:47 +0100 Subject: [PATCH 14/36] fix PHPStan @throws incompatible warning --- src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php index 89295717e..9af852bba 100644 --- a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php @@ -29,6 +29,7 @@ use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\protocol\types\CommandData; use pocketmine\network\mcpe\protocol\types\CommandEnum; use pocketmine\network\mcpe\protocol\types\CommandParameter; +use pocketmine\utils\BinaryDataException; use function count; use function dechex; From a145e18c1e23ea4772a6daa55b1541c963f02229 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 16:08:37 +0100 Subject: [PATCH 15/36] CrashDump: use fully qualified reference for GIT_COMMIT constant this makes it easier to filter out PHPStan noise. --- src/pocketmine/CrashDump.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/CrashDump.php b/src/pocketmine/CrashDump.php index a18765297..df7d0fb48 100644 --- a/src/pocketmine/CrashDump.php +++ b/src/pocketmine/CrashDump.php @@ -333,7 +333,7 @@ class CrashDump{ $this->data["general"]["php_os"] = PHP_OS; $this->data["general"]["os"] = Utils::getOS(); $this->addLine($this->server->getName() . " version: " . $version->getFullVersion(true) . " [Protocol " . ProtocolInfo::CURRENT_PROTOCOL . "]"); - $this->addLine("Git commit: " . GIT_COMMIT); + $this->addLine("Git commit: " . \pocketmine\GIT_COMMIT); $this->addLine("uname -a: " . php_uname("a")); $this->addLine("PHP Version: " . phpversion()); $this->addLine("Zend version: " . zend_version()); From 0d5d5e21a80e41bd0f15bbeff1386b42d05d5200 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 16:11:02 +0100 Subject: [PATCH 16/36] CommandReader: define $w and $e to make PHPStan happy --- src/pocketmine/command/CommandReader.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pocketmine/command/CommandReader.php b/src/pocketmine/command/CommandReader.php index dfa66ba28..1aaa1721d 100644 --- a/src/pocketmine/command/CommandReader.php +++ b/src/pocketmine/command/CommandReader.php @@ -141,6 +141,7 @@ class CommandReader extends Thread{ case self::TYPE_STREAM: //stream_select doesn't work on piped streams for some reason $r = [self::$stdin]; + $w = $e = null; if(($count = stream_select($r, $w, $e, 0, 200000)) === 0){ //nothing changed in 200000 microseconds return true; }elseif($count === false){ //stream error From 1bce5d0bc2da25dbb375a37fd5db402500447b3b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 21:26:22 +0100 Subject: [PATCH 17/36] PocketMine.php: move BaseClassLoader creation to where it's actually used --- src/pocketmine/PocketMine.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index a17d9797c..f4f5c5e68 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -187,12 +187,6 @@ namespace pocketmine { set_error_handler([Utils::class, 'errorExceptionHandler']); - /* - * We now use the Composer autoloader, but this autoloader is still for loading plugins. - */ - $autoloader = new \BaseClassLoader(); - $autoloader->register(false); - $version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER); define('pocketmine\VERSION', $version->getFullVersion(true)); @@ -275,6 +269,13 @@ namespace pocketmine { //TODO: move this to a Server field define('pocketmine\START_TIME', microtime(true)); ThreadManager::init(); + + /* + * We now use the Composer autoloader, but this autoloader is still for loading plugins. + */ + $autoloader = new \BaseClassLoader(); + $autoloader->register(false); + new Server($autoloader, $logger, \pocketmine\DATA, \pocketmine\PLUGIN_PATH); $logger->info("Stopping other threads"); From 274cf58ccf8821e48dc8527c76b9b786ddd9d60f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 21:38:47 +0100 Subject: [PATCH 18/36] PocketMine.php: remove useless ini_set() (this is a PHP_INI_SYSTEM directive which can't be changed at runtime) --- src/pocketmine/PocketMine.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index f4f5c5e68..00e1aae43 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -141,7 +141,6 @@ namespace pocketmine { ini_set("display_errors", '1'); ini_set("display_startup_errors", '1'); ini_set("default_charset", "utf-8"); - @ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors ini_set('assert.exception', '1'); } From 0840ba8067af7fc9fabbbd29ae27ec06f4087013 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 26 Oct 2019 21:37:15 +0100 Subject: [PATCH 19/36] PocketMine.php: reduce unnecessary pocketmine\NAME dependencies --- src/pocketmine/PocketMine.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 00e1aae43..1b040dcb5 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -57,18 +57,18 @@ namespace pocketmine { if(version_compare(MIN_PHP_VERSION, PHP_VERSION) > 0){ //If PHP version isn't high enough, anything below might break, so don't bother checking it. return [ - \pocketmine\NAME . " requires PHP >= " . MIN_PHP_VERSION . ", but you have PHP " . PHP_VERSION . "." + "PHP >= " . MIN_PHP_VERSION . " is required, but you have PHP " . PHP_VERSION . "." ]; } $messages = []; if(PHP_INT_SIZE < 8){ - $messages[] = "Running " . \pocketmine\NAME . " with 32-bit systems/PHP is no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system."; + $messages[] = "32-bit systems/PHP are no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system."; } if(php_sapi_name() !== "cli"){ - $messages[] = "You must run " . \pocketmine\NAME . " using the CLI."; + $messages[] = "Only PHP CLI is supported."; } $extensions = [ From b5a98a993faebc39033b0fdb24c3a57bdb19a657 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 27 Oct 2019 20:58:43 +0000 Subject: [PATCH 20/36] lazy-init RuntimeBlockMapping --- .../mcpe/protocol/types/RuntimeBlockMapping.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php b/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php index 9ba73cbb4..606148d1b 100644 --- a/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php +++ b/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php @@ -40,8 +40,8 @@ final class RuntimeBlockMapping{ private static $legacyToRuntimeMap = []; /** @var int[] */ private static $runtimeToLegacyMap = []; - /** @var mixed[] */ - private static $bedrockKnownStates; + /** @var mixed[]|null */ + private static $bedrockKnownStates = null; private function __construct(){ //NOOP @@ -77,6 +77,12 @@ final class RuntimeBlockMapping{ } } + private static function lazyInit() : void{ + if(self::$bedrockKnownStates === null){ + self::init(); + } + } + /** * Randomizes the order of the runtimeID table to prevent plugins relying on them. * Plugins shouldn't use this stuff anyway, but plugin devs have an irritating habit of ignoring what they @@ -101,6 +107,7 @@ final class RuntimeBlockMapping{ * @return int */ public static function toStaticRuntimeId(int $id, int $meta = 0) : int{ + self::lazyInit(); /* * try id+meta first * if not found, try id+0 (strip meta) @@ -115,6 +122,7 @@ final class RuntimeBlockMapping{ * @return int[] [id, meta] */ public static function fromStaticRuntimeId(int $runtimeId) : array{ + self::lazyInit(); $v = self::$runtimeToLegacyMap[$runtimeId]; return [$v >> 4, $v & 0xf]; } @@ -128,7 +136,7 @@ final class RuntimeBlockMapping{ * @return array */ public static function getBedrockKnownStates() : array{ + self::lazyInit(); return self::$bedrockKnownStates; } } -RuntimeBlockMapping::init(); From 35fabc77651d50e1da338e58a0591efdc7e628b7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Oct 2019 16:03:26 +0000 Subject: [PATCH 21/36] updated DevTools submodule to 1.13.5 --- tests/plugins/PocketMine-DevTools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/PocketMine-DevTools b/tests/plugins/PocketMine-DevTools index 3fadb2c3f..73c96dfdb 160000 --- a/tests/plugins/PocketMine-DevTools +++ b/tests/plugins/PocketMine-DevTools @@ -1 +1 @@ -Subproject commit 3fadb2c3f45a528a715733ba41c273289ef8ffb1 +Subproject commit 73c96dfdbac9c9d44f3b10192540d7ff71a1051b From 0c91d568b41e9406778c97695486d85c5f88e280 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Oct 2019 16:07:35 +0000 Subject: [PATCH 22/36] Release 3.9.7 --- changelogs/3.9.md | 7 ++++++- src/pocketmine/VersionInfo.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelogs/3.9.md b/changelogs/3.9.md index 0618aef71..57c82b7cd 100644 --- a/changelogs/3.9.md +++ b/changelogs/3.9.md @@ -99,4 +99,9 @@ Plugin developers should **only** update their required API to this version if y - `pocketmine\level\Explosion`: - `explodeA()` - `explodeB()` -- Fixed various cosmetic documentation inconsistencies in the core and dependencies. \ No newline at end of file +- Fixed various cosmetic documentation inconsistencies in the core and dependencies. + +# 3.9.7 +- Fixed a crash that could occur during timezone detection. +- Squid no longer spin around constantly in enclosed spaces. Their performance impact is reduced. +- Cleaned up the bootstrap file. \ No newline at end of file diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index fd7e7bd86..4ae068b90 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -23,5 +23,5 @@ namespace pocketmine; const NAME = "PocketMine-MP"; const BASE_VERSION = "3.9.7"; -const IS_DEVELOPMENT_BUILD = true; +const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0; From 5edff79f5f4466130e8de1043f65da6a3a86a491 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Oct 2019 16:07:35 +0000 Subject: [PATCH 23/36] 3.9.8 is next --- src/pocketmine/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 4ae068b90..c9c78f83e 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -22,6 +22,6 @@ namespace pocketmine; const NAME = "PocketMine-MP"; -const BASE_VERSION = "3.9.7"; -const IS_DEVELOPMENT_BUILD = false; +const BASE_VERSION = "3.9.8"; +const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0; From 4cb0b319c046f6cd22a35d604ba90cff2365cfcb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 11:16:22 +0000 Subject: [PATCH 24/36] load some non-class constants with composer this makes PHPStan happy and also makes working with PM code externally less of a pain in the ass. --- composer.json | 6 +++++- src/pocketmine/GlobalConstants.php | 30 ++++++++++++++++++++++++++++++ src/pocketmine/PocketMine.php | 6 ------ src/pocketmine/VersionInfo.php | 8 ++++++++ 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 src/pocketmine/GlobalConstants.php diff --git a/composer.json b/composer.json index cce152633..d9216be1a 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,11 @@ "autoload": { "psr-4": { "": ["src"] - } + }, + "files": [ + "src/pocketmine/GlobalConstants.php", + "src/pocketmine/VersionInfo.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/src/pocketmine/GlobalConstants.php b/src/pocketmine/GlobalConstants.php new file mode 100644 index 000000000..a9550cc43 --- /dev/null +++ b/src/pocketmine/GlobalConstants.php @@ -0,0 +1,30 @@ + Date: Tue, 5 Nov 2019 11:16:49 +0000 Subject: [PATCH 25/36] introduced baseline PHPStan configuration --- phpstan.neon | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 phpstan.neon diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..2f01e8fe9 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,158 @@ + + +parameters: + level: 1 + paths: + - src + #reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings + ignoreErrors: + - + message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#" + path: src/pocketmine/Player.php + + - + message: "#^Function pocketmine\\\\critical_error not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\check_platform_dependencies not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\emit_performance_warnings not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\set_ini_entries not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\server not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function check_platform_dependencies not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function critical_error not found\\.$#" + count: 6 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function set_ini_entries not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function emit_performance_warnings not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\server not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Constant MIN_PHP_VERSION not found\\.$#" + count: 2 + path: src/pocketmine/PocketMine.php + + - + message: "#^pocketmine\\\\block\\\\[A-Za-z\\d]+\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#" + path: src/pocketmine/block + + - + message: "#^pocketmine\\\\block\\\\Block\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\level\\\\Position\\.$#" + count: 1 + path: src/pocketmine/block/Block.php + + - + message: "#^pocketmine\\\\inventory\\\\DoubleChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#" + count: 1 + path: src/pocketmine/inventory/DoubleChestInventory.php + + - + message: "#^pocketmine\\\\inventory\\\\EnderChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#" + count: 1 + path: src/pocketmine/inventory/EnderChestInventory.php + + - + message: "#^pocketmine\\\\item\\\\GoldenAppleEnchanted\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\GoldenApple\\.$#" + count: 1 + path: src/pocketmine/item/GoldenAppleEnchanted.php + + - + message: "#^pocketmine\\\\item\\\\WrittenBook\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\WritableBook\\.$#" + count: 1 + path: src/pocketmine/item/WrittenBook.php + + - + message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\hell\\\\Nether has an unused parameter \\$options\\.$#" + count: 1 + path: src/pocketmine/level/generator/hell/Nether.php + + - + message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\normal\\\\Normal has an unused parameter \\$options\\.$#" + count: 1 + path: src/pocketmine/level/generator/normal/Normal.php + + - + message: "#^Used constant pocketmine\\\\RESOURCE_PATH not found\\.$#" + count: 1 + path: src/pocketmine/network/mcpe/protocol/StartGamePacket.php + + - + message: "#^Instantiated class COM not found\\.$#" + count: 2 + path: src/pocketmine/network/upnp/UPnP.php + comment: "only available on Windows" + + - + message: "#^Constructor of class pocketmine\\\\scheduler\\\\TaskScheduler has an unused parameter \\$logger\\.$#" + count: 1 + path: src/pocketmine/scheduler/TaskScheduler.php + + - + message: "#^Variable \\$GLOBALS in isset\\(\\) always exists and is not nullable\\.$#" + path: src/pocketmine/MemoryManager.php + comment: "this isn't defined on threads (thanks pthreads)" + + - + message: "#^Constant pocketmine\\\\COMPOSER_AUTOLOADER_PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\DATA not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\GIT_COMMIT not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\PLUGIN_PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\RESOURCE_PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\START_TIME not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\VERSION not found\\.$#" + path: src/pocketmine From a86bcd51105a748e1e28c1d79c9bc99476f5bd23 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 19:39:04 +0000 Subject: [PATCH 26/36] travis.sh: don't redownload phpunit if it already locally exists --- tests/travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/travis.sh b/tests/travis.sh index 049ec0526..45d5672e4 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -21,7 +21,7 @@ if [ $? -ne 0 ]; then exit 1 fi -curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar +[ ! -f phpunit.phar ] && echo "Downloading PHPUnit..." && curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar "$PHP_BINARY" phpunit.phar --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit || exit 1 #Run-the-server tests From 714f4dc023dde8e7455faa21ac135bb55ec34db2 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 19:42:37 +0000 Subject: [PATCH 27/36] fortify CI with PHPStan --- tests/travis.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/travis.sh b/tests/travis.sh index 45d5672e4..a58341493 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -21,6 +21,10 @@ if [ $? -ne 0 ]; then exit 1 fi +[ ! -f phpstan.phar ] && echo "Downloading PHPStan..." && curl -sSLO https://github.com/phpstan/phpstan/releases/download/0.11.19/phpstan.phar +"$PHP_BINARY" phpstan.phar analyze --no-progress --memory-limit=2G || exit 1 +echo "PHPStan scan succeeded" + [ ! -f phpunit.phar ] && echo "Downloading PHPUnit..." && curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar "$PHP_BINARY" phpunit.phar --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit || exit 1 From c5d3e9be767c6227e7d269e97c63366fbb80cfa9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 20:21:36 +0000 Subject: [PATCH 28/36] phpstan: silence leveldb noise maybe there's a better way to do this, but I don't know it yet. --- phpstan.neon | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 2f01e8fe9..f5178b81c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,7 +4,7 @@ parameters: level: 1 paths: - src - #reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings + reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings ignoreErrors: - message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#" @@ -156,3 +156,21 @@ parameters: - message: "#^Constant pocketmine\\\\VERSION not found\\.$#" path: src/pocketmine + - + message: "#^Used constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + comment: "explicitly checked" + - + message: "#^Constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + comment: "explicitly checked" + - + message: "#^Instantiated class LevelDB not found\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + comment: "leveldb extension currently optional" + - + message: "#^Return typehint of method pocketmine\\\\level\\\\format\\\\io\\\\leveldb\\\\LevelDB\\:\\:createDB\\(\\) has invalid type LevelDB\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + - + message: "#^Return typehint of method pocketmine\\\\level\\\\format\\\\io\\\\leveldb\\\\LevelDB\\:\\:getDatabase\\(\\) has invalid type LevelDB\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php From cac3c356a5a83cf6cada0269e86f8d8d11e80c52 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 6 Nov 2019 14:29:43 -0500 Subject: [PATCH 29/36] Painting: fix dropping multiple items when multiple blockupdates occur in the same tick test case: place sand on top of a line of signs, put a painting on the sand and break the supporting sign fixes #2774 for stable --- src/pocketmine/entity/object/Painting.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/entity/object/Painting.php b/src/pocketmine/entity/object/Painting.php index 70e47307f..f60368519 100644 --- a/src/pocketmine/entity/object/Painting.php +++ b/src/pocketmine/entity/object/Painting.php @@ -90,6 +90,9 @@ class Painting extends Entity{ } public function kill() : void{ + if(!$this->isAlive()){ + return; + } parent::kill(); $drops = true; From 95812252d6969c300d18e9dc1c339114c2b75b1c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 6 Nov 2019 22:48:08 +0000 Subject: [PATCH 30/36] NetworkBinaryStream: fix a mistake in doc for putEntityRuntimeId() --- src/pocketmine/network/mcpe/NetworkBinaryStream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index ba48a129b..32a3629e9 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -378,7 +378,7 @@ class NetworkBinaryStream extends BinaryStream{ } /** - * Writes an EntityUniqueID + * Writes an EntityRuntimeID * * @param int $eid */ From 932418b951684f57a02e8202a0a3a663e1a1b3a1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 7 Nov 2019 18:22:21 +0000 Subject: [PATCH 31/36] fixing some PHPStan complaints about bootstrap this isn't an ideal fix, but it'll do. --- phpstan.neon | 58 ++--------------------------------- src/pocketmine/PocketMine.php | 4 ++- tests/phpstan/bootstrap.php | 24 +++++++++++++++ 3 files changed, 30 insertions(+), 56 deletions(-) create mode 100644 tests/phpstan/bootstrap.php diff --git a/phpstan.neon b/phpstan.neon index f5178b81c..eeae576fe 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,9 @@ parameters: level: 1 + autoload_files: + - tests/phpstan/bootstrap.php + - src/pocketmine/PocketMine.php paths: - src reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings @@ -10,61 +13,6 @@ parameters: message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#" path: src/pocketmine/Player.php - - - message: "#^Function pocketmine\\\\critical_error not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\check_platform_dependencies not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\emit_performance_warnings not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\set_ini_entries not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\server not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function check_platform_dependencies not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function critical_error not found\\.$#" - count: 6 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function set_ini_entries not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function emit_performance_warnings not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\server not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Constant MIN_PHP_VERSION not found\\.$#" - count: 2 - path: src/pocketmine/PocketMine.php - - message: "#^pocketmine\\\\block\\\\[A-Za-z\\d]+\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#" path: src/pocketmine/block diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index bf01d54fa..bf3912e9e 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -291,5 +291,7 @@ namespace pocketmine { exit($exitCode); } - \pocketmine\server(); + if(!defined('pocketmine\_PHPSTAN_ANALYSIS')){ + \pocketmine\server(); + } } diff --git a/tests/phpstan/bootstrap.php b/tests/phpstan/bootstrap.php new file mode 100644 index 000000000..10b2da0fc --- /dev/null +++ b/tests/phpstan/bootstrap.php @@ -0,0 +1,24 @@ + Date: Sat, 9 Nov 2019 17:33:25 +0000 Subject: [PATCH 32/36] updated build/php submodule --- build/php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/php b/build/php index 8666ae5ad..185d74199 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 8666ae5add7a8b5213d68b491ebf0de211998cc9 +Subproject commit 185d7419914005530298bd5e069449bdf4c0be56 From 025cb73bf5d13af95425998c074322c412ccea8e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 9 Nov 2019 17:34:04 +0000 Subject: [PATCH 33/36] update travis pthreads --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2525a1f80..dcc2e1298 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_script: - echo | pecl install channel://pecl.php.net/yaml-2.0.4 - git clone https://github.com/pmmp/pthreads.git - cd pthreads - - git checkout 6ca019c58b4fa09ee2ff490f2444e34bef0773d0 + - git checkout 1b7da492b944146fa9680f6399bd9c6c6c6095e0 - phpize - ./configure - make From 8d2e3894ef9c67d44cc094df1363cfe6b9a7b1a6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 11 Nov 2019 15:41:08 +0000 Subject: [PATCH 34/36] DataPacket: fixed var_dump() not showing private & protected subclass properties --- src/pocketmine/network/mcpe/protocol/DataPacket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/protocol/DataPacket.php b/src/pocketmine/network/mcpe/protocol/DataPacket.php index 7d074d515..f2e60caa5 100644 --- a/src/pocketmine/network/mcpe/protocol/DataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/DataPacket.php @@ -143,7 +143,7 @@ abstract class DataPacket extends NetworkBinaryStream{ public function __debugInfo(){ $data = []; - foreach($this as $k => $v){ + foreach((array) $this as $k => $v){ if($k === "buffer" and is_string($v)){ $data[$k] = bin2hex($v); }elseif(is_string($v) or (is_object($v) and method_exists($v, "__toString"))){ From 314ce1d01234764896f719052022487ad6dd0b39 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 11 Nov 2019 16:41:50 +0000 Subject: [PATCH 35/36] build/make-release: push after 5 seconds instead of 10 --- build/make-release.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/make-release.php b/build/make-release.php index f23a036e1..c8a475e57 100644 --- a/build/make-release.php +++ b/build/make-release.php @@ -76,6 +76,6 @@ system('git tag ' . $currentVer->getBaseVersion()); replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true); system('git add "' . $versionInfoPath . '"'); system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"'); -echo "pushing changes in 10 seconds\n"; -sleep(10); +echo "pushing changes in 5 seconds\n"; +sleep(5); system('git push origin HEAD ' . $currentVer->getBaseVersion()); From 3e4366b30d4cbe6a1a4c35c253253562bb41ece1 Mon Sep 17 00:00:00 2001 From: Dylan T Date: Wed, 20 Nov 2019 10:51:07 +0000 Subject: [PATCH 36/36] readme: add XLM since Keybase made it so easy ... and also gave lots of keybase users free XLM. Well played, Keybase, you managed to make me adopt Stellar. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5b4e0fcbc..ec613ee56 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ ## Donate - Bitcoin Cash (BCH): `qq3r46hn6ljnhnqnfwxt5pg3g447eq9jhvw5ddfear` - Bitcoin (BTC): `171u8K9e4FtU6j3e5sqNoxKUgEw9qWQdRV` +- Stellar Lumens (XLM): `GAAC5WZ33HCTE3BFJFZJXONMEIBNHFLBXM2HJVAZHXXPYA3HP5XPPS7T` - [Patreon](https://www.patreon.com/pocketminemp) ## Licensing information