From b25d926acd4115346ad455b3b1782685725fae8c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 26 Jan 2017 16:16:31 +0100 Subject: [PATCH] Let's not break stuff --- src/danog/MadelineProto/Connection.php | 2 +- src/danog/MadelineProto/MTProto.php | 5 +---- tests/testing.php | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/danog/MadelineProto/Connection.php b/src/danog/MadelineProto/Connection.php index 473720b2..6bc5fdf1 100644 --- a/src/danog/MadelineProto/Connection.php +++ b/src/danog/MadelineProto/Connection.php @@ -179,7 +179,7 @@ class Connection throw new Exception("Connection: couldn't connect to socket."); } $packet = stream_get_contents($this->sock, $length); - if ($packet === false || strlen($packet) != $length) { + if (strlen($packet) != $length) { throw new \danog\MadelineProto\Exception("WARNING: Wrong length was read (should've read ".($length).', read '.strlen($packet).')!'); } diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 1dd7085a..0a8ac09d 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -225,10 +225,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB public function setup_logger() { - //if (!\danog\MadelineProto\Logger::$constructed) { - // Set up logger class - \danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'], isset($this->datacenter->authorization['user']) ? (isset($this->datacenter->authorization['user']['username']) ? $this->datacenter->authorization['user']['username'] : $this->datacenter->authorization['user']['id']) : '', $this->settings['logger']['logger_level']); - //} + \danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'], isset($this->datacenter->authorization['user']) ? (isset($this->datacenter->authorization['user']['username']) ? $this->datacenter->authorization['user']['username'] : $this->datacenter->authorization['user']['id']) : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE); } public function reset_session($de = true) diff --git a/tests/testing.php b/tests/testing.php index 47ce6366..68b72c66 100755 --- a/tests/testing.php +++ b/tests/testing.php @@ -17,7 +17,7 @@ if (file_exists('web_data.php')) { } echo 'Deserializing MadelineProto from session.madeline...'.PHP_EOL; -$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline'); +$MadelineProto = \danog\MadelineProto\Serialization::deserialize('/tmp/pwr.madeline'); if (file_exists('.env')) { echo 'Loading .env...'.PHP_EOL;