From 5f7bf4c907ea66d41ff33b521ca272589a9aa401 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 27 Aug 2017 20:24:05 +0200 Subject: [PATCH] PHP 5 fixes --- src/danog/MadelineProto/MTProtoTools/CallHandler.php | 2 +- src/danog/MadelineProto/TL/Conversion/BotAPI.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/danog/MadelineProto/MTProtoTools/CallHandler.php b/src/danog/MadelineProto/MTProtoTools/CallHandler.php index 240ba644..c3a18a83 100644 --- a/src/danog/MadelineProto/MTProtoTools/CallHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/CallHandler.php @@ -31,7 +31,7 @@ trait CallHandler if (isset($args['id']['_']) && isset($args['id']['dc_id']) && $args['id']['_'] === 'inputBotInlineMessageID') { $aargs['datacenter'] = $args['id']['dc_id']; } - if (basename(debug_backtrace(0)[0]['file']) === 'APIFactory.php' && isset(self::DISALLOWED_METHODS[$method])) { + if (basename(debug_backtrace(0)[0]['file']) === 'APIFactory.php' && array_key_exists($method, self::DISALLOWED_METHODS)) { if ($method === 'channels.getParticipants' && isset($args['filter']) && $args['filter'] === ['_' => 'channelParticipantsRecent']) { \danog\MadelineProto\Logger::log([self::DISALLOWED_METHODS[$method]], \danog\MadelineProto\Logger::FATAL_ERROR); } else { diff --git a/src/danog/MadelineProto/TL/Conversion/BotAPI.php b/src/danog/MadelineProto/TL/Conversion/BotAPI.php index 07a46f0c..5375fc7e 100644 --- a/src/danog/MadelineProto/TL/Conversion/BotAPI.php +++ b/src/danog/MadelineProto/TL/Conversion/BotAPI.php @@ -408,7 +408,8 @@ trait BotAPI $text = $this->html_entity_decode($node->textContent); $href = $node->getAttribute('href'); if (preg_match('|mention:|', $href)) { - if (!isset(($mention = $this->get_info(str_replace('mention:', '', $href)))['InputUser'])) { + $mention = $this->get_info(str_replace('mention:', '', $href)); + if (!isset($mention['InputUser'])) { throw new \danog\MadelineProto\Exception('This peer is not present in the internal peer database'); } $entities[] = ['_' => 'inputMessageEntityMentionName', 'offset' => mb_strlen($nmessage), 'length' => mb_strlen($text), 'user_id' => $mention['InputUser']];