diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index db11d1d48..87b8b2f97 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1453,7 +1453,11 @@ class Server{ define('pocketmine\DEBUG', (int) $this->getProperty("debug.level", 1)); - ini_set('assert.exception', 1); + if(((int) ini_get('zend.assertions')) > 0 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."); + } + + ini_set('assert.exception', (bool) $this->getProperty("debug.assertions.throw-exception", 0)); if($this->logger instanceof MainLogger){ $this->logger->setLogDebug(\pocketmine\DEBUG > 1); diff --git a/src/pocketmine/resources/pocketmine.yml b/src/pocketmine/resources/pocketmine.yml index b32cdd72c..442258b5c 100644 --- a/src/pocketmine/resources/pocketmine.yml +++ b/src/pocketmine/resources/pocketmine.yml @@ -85,6 +85,12 @@ network: 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 + #Enable throwing exceptions when assertions fail, will allow obtaining more detailed information on the failed assertion, but may cause a server crash. + #If set to false, a warning will be raised instead of throwing an exception. + throw-exception: false #If > 1, it will show debug messages in the console level: 1 #Enables /status, /gc