From 43410cdafbf670d8446607058d6a45ffc2bb53fe Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 5 Jan 2019 18:47:29 +0000 Subject: [PATCH 1/3] Server: warn on assertions !== -1, closes #2640 --- src/pocketmine/Server.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 6821feb43..ec6e3904e 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1551,7 +1551,7 @@ class Server{ return; } - if(((int) ini_get('zend.assertions')) > 0 and ((bool) $this->getProperty("debug.assertions.warn-if-enabled", true)) !== false){ + if(((int) ini_get('zend.assertions')) !== -1 and ((bool) $this->getProperty("debug.assertions.warn-if-enabled", true)) !== false){ $this->logger->warning("Debugging assertions are enabled, this may impact on performance. To disable them, set `zend.assertions = -1` in php.ini."); } From 946a1036f1c54bc89fefc39e7e62e24151e246d8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 5 Jan 2019 18:49:15 +0000 Subject: [PATCH 2/3] Drop warn-if-enabled for asserts I don't know why this is optional when no other debug warnings are. --- src/pocketmine/Server.php | 2 +- src/pocketmine/resources/pocketmine.yml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index ec6e3904e..14b92e232 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1551,7 +1551,7 @@ class Server{ return; } - if(((int) ini_get('zend.assertions')) !== -1 and ((bool) $this->getProperty("debug.assertions.warn-if-enabled", true)) !== false){ + 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."); } diff --git a/src/pocketmine/resources/pocketmine.yml b/src/pocketmine/resources/pocketmine.yml index c62ecfa76..bddeef1b6 100644 --- a/src/pocketmine/resources/pocketmine.yml +++ b/src/pocketmine/resources/pocketmine.yml @@ -96,10 +96,6 @@ network: max-mtu-size: 1492 debug: - #To enable assertion execution, set zend.assertions in your php.ini to 1 - assertions: - #Warn if assertions are enabled in php.ini, due to assertions may impact on runtime performance if enabled. - warn-if-enabled: true #If > 1, it will show debug messages in the console level: 1 #Enables /status, /gc From 93969197f73cf4246f48040bec331a0fc0b5acd4 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 5 Jan 2019 18:56:52 +0000 Subject: [PATCH 3/3] Enable status,gc,dumpmemory OOB dumpmemory has been confined to console by default due to the hazards it poses to a running server. closes #2528 --- src/pocketmine/command/SimpleCommandMap.php | 11 +++-------- src/pocketmine/permission/DefaultPermissions.php | 2 +- src/pocketmine/resources/pocketmine.yml | 2 -- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/pocketmine/command/SimpleCommandMap.php b/src/pocketmine/command/SimpleCommandMap.php index 036d8a28a..88d95a5ba 100644 --- a/src/pocketmine/command/SimpleCommandMap.php +++ b/src/pocketmine/command/SimpleCommandMap.php @@ -100,9 +100,11 @@ class SimpleCommandMap implements CommandMap{ new DefaultGamemodeCommand("defaultgamemode"), new DeopCommand("deop"), new DifficultyCommand("difficulty"), + new DumpMemoryCommand("dumpmemory"), new EffectCommand("effect"), new EnchantCommand("enchant"), new GamemodeCommand("gamemode"), + new GarbageCollectorCommand("gc"), new GiveCommand("give"), new HelpCommand("help"), new KickCommand("kick"), @@ -122,6 +124,7 @@ class SimpleCommandMap implements CommandMap{ new SeedCommand("seed"), new SetWorldSpawnCommand("setworldspawn"), new SpawnpointCommand("spawnpoint"), + new StatusCommand("status"), new StopCommand("stop"), new TeleportCommand("tp"), new TellCommand("tell"), @@ -132,14 +135,6 @@ class SimpleCommandMap implements CommandMap{ new VersionCommand("version"), new WhitelistCommand("whitelist") ]); - - if($this->server->getProperty("debug.commands", false)){ - $this->registerAll("pocketmine", [ - new StatusCommand("status"), - new GarbageCollectorCommand("gc"), - new DumpMemoryCommand("dumpmemory") - ]); - } } diff --git a/src/pocketmine/permission/DefaultPermissions.php b/src/pocketmine/permission/DefaultPermissions.php index aa2584b8d..5529d5adf 100644 --- a/src/pocketmine/permission/DefaultPermissions.php +++ b/src/pocketmine/permission/DefaultPermissions.php @@ -119,7 +119,7 @@ abstract class DefaultPermissions{ self::registerPermission(new Permission(self::ROOT . ".command.seed", "Allows the user to view the seed of the world", Permission::DEFAULT_OP), $commands); self::registerPermission(new Permission(self::ROOT . ".command.status", "Allows the user to view the server performance", Permission::DEFAULT_OP), $commands); self::registerPermission(new Permission(self::ROOT . ".command.gc", "Allows the user to fire garbage collection tasks", Permission::DEFAULT_OP), $commands); - self::registerPermission(new Permission(self::ROOT . ".command.dumpmemory", "Allows the user to dump memory contents", Permission::DEFAULT_OP), $commands); + self::registerPermission(new Permission(self::ROOT . ".command.dumpmemory", "Allows the user to dump memory contents", Permission::DEFAULT_FALSE), $commands); self::registerPermission(new Permission(self::ROOT . ".command.timings", "Allows the user to records timings for all plugin events", Permission::DEFAULT_OP), $commands); self::registerPermission(new Permission(self::ROOT . ".command.spawnpoint", "Allows the user to change player's spawnpoint", Permission::DEFAULT_OP), $commands); self::registerPermission(new Permission(self::ROOT . ".command.setworldspawn", "Allows the user to change the world spawn", Permission::DEFAULT_OP), $commands); diff --git a/src/pocketmine/resources/pocketmine.yml b/src/pocketmine/resources/pocketmine.yml index bddeef1b6..ab927a1b0 100644 --- a/src/pocketmine/resources/pocketmine.yml +++ b/src/pocketmine/resources/pocketmine.yml @@ -98,8 +98,6 @@ network: debug: #If > 1, it will show debug messages in the console level: 1 - #Enables /status, /gc - commands: false player: #Choose whether to enable player data saving.