From 3b2a7e68f3cf3defc258e194c35125e2ed692eeb Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 5 Mar 2013 13:26:10 +0100 Subject: [PATCH] Fixed DevTools plugin related issues --- src/PocketMinecraftServer.php | 4 ++-- src/config.php | 7 ++++++- src/functions.php | 1 - src/utils/Utils.php | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 8e5aefa4e..b29346508 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -41,8 +41,8 @@ class PocketMinecraftServer{ if($this->port < 19132 or $this->port > 19135){ console("[WARNING] You've selected a not-standard port. Normal port range is from 19132 to 19135 included"); } - $this->serverID = $this->serverID === false ? Utils::readLong(Utils::getRandomBytes(8)):$this->serverID; - $this->seed = $this->seed === false ? Utils::readInt(Utils::getRandomBytes(4)):$this->seed; + $this->serverID = $this->serverID === false ? Utils::readLong(Utils::getRandomBytes(8, false)):$this->serverID; + $this->seed = $this->seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):$this->seed; console("[INFO] Loading database..."); $this->startDatabase(); $this->doTick = false; diff --git a/src/config.php b/src/config.php index d61076a1b..fa5f0559d 100644 --- a/src/config.php +++ b/src/config.php @@ -32,8 +32,13 @@ error_reporting(E_ALL ^ E_NOTICE); ini_set("allow_url_fopen", 1); ini_set("display_errors", 1); ini_set('default_charset', 'utf-8'); -define("FILE_PATH", realpath(dirname(__FILE__)."/../")."/"); +if(defined("POCKETMINE_COMPILE") and POCKETMINE_COMPILE === true){ + define("FILE_PATH", realpath(dirname(__FILE__))."/"); +}else{ + define("FILE_PATH", realpath(dirname(__FILE__)."/../")."/"); +} set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH); + ini_set("memory_limit", "256M"); //Default define("LOG", true); define("MAGIC", "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78"); diff --git a/src/functions.php b/src/functions.php index 9fbf0630e..b6420dbbf 100644 --- a/src/functions.php +++ b/src/functions.php @@ -207,7 +207,6 @@ function console($message, $EOL = true, $log = true, $level = 1){ } function fatal_handler($errno, $errstr, $errfile, $errline){ - global $lasttrace; console("[ERROR] A level ".$errno." error happened: \"$errstr\" in \"$errfile\" at line $errline", true, true, 0); return false; } diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 7828ec455..49a52c8de 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -252,7 +252,7 @@ class Utils extends Thread{ //some entropy, but works ^^ $weakEntropy = array( is_array($startEntropy) ? implode($startEntropy):$startEntropy, - serialize(stat(__FILE__)), + serialize(@stat(__FILE__)), __DIR__, PHP_OS, microtime(),