PHP 5 fixes

This commit is contained in:
Daniil Gentili 2017-08-27 20:24:05 +02:00
parent dffe765edc
commit 5f7bf4c907
2 changed files with 3 additions and 2 deletions

View File

@ -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 {

View File

@ -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']];