Bugfixes
This commit is contained in:
parent
8147bf90c0
commit
d9aeab0f91
@ -86,7 +86,7 @@ class Lua
|
||||
|
||||
private function convert_array($array)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
if (!$this->is_array($value)) {
|
||||
return $array;
|
||||
}
|
||||
if ($this->is_seqential($value)) {
|
||||
|
@ -143,18 +143,18 @@ class MTProto
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
if (isset(debug_backtrace()[0]['file']) && (debug_backtrace()[0]['file'] === __DIR__.'/Threads/SocketReader.php' || (debug_backtrace()[0]['file'] === __FILE__ && debug_backtrace()[0]['line'] === 117))) {
|
||||
if (class_exists('\Thread') && method_exists('\Thread', 'getCurrentThread') && is_object(\Thread::getCurrentThread())) {
|
||||
return;
|
||||
}
|
||||
$this->bigint = PHP_INT_SIZE < 8;
|
||||
$this->setup_logger();
|
||||
$this->reset_session();
|
||||
if (!isset($this->v) || $this->v !== $this->getV()) {
|
||||
\danog\MadelineProto\Logger::log(['Serialization is out of date, reconstructing object!'], Logger::WARNING);
|
||||
$this->__construct($this->settings);
|
||||
}
|
||||
$this->setup_threads();
|
||||
$this->datacenter->__construct($this->settings['connection'], $this->settings['connection_settings']);
|
||||
$this->reset_session();
|
||||
if ($this->authorized && $this->settings['updates']['handle_updates']) {
|
||||
\danog\MadelineProto\Logger::log(['Getting updates after deserialization...'], Logger::NOTICE);
|
||||
$this->get_updates_difference();
|
||||
|
@ -19,10 +19,10 @@ trait CallHandler
|
||||
{
|
||||
public function method_call($method, $args = [], $aargs = ['message_id' => null, 'heavy' => false])
|
||||
{
|
||||
if (!is_array($args)) {
|
||||
if (!$this->is_array($args)) {
|
||||
throw new \danog\MadelineProto\Exception("Arguments aren't an array.");
|
||||
}
|
||||
if (!is_array($aargs)) {
|
||||
if (!$this->is_array($aargs)) {
|
||||
throw new \danog\MadelineProto\Exception("Additonal arguments aren't an array.");
|
||||
}
|
||||
if (!isset($aargs['datacenter'])) {
|
||||
@ -146,7 +146,7 @@ trait CallHandler
|
||||
|
||||
public function object_call($object, $args = [], $aargs = ['message_id' => null, 'heavy' => false])
|
||||
{
|
||||
if (!is_array($args)) {
|
||||
if (!$this->is_array($args)) {
|
||||
throw new \danog\MadelineProto\Exception("Arguments aren't an array.");
|
||||
}
|
||||
if (!isset($aargs['datacenter'])) {
|
||||
|
@ -134,7 +134,7 @@ trait PeerHandler
|
||||
|
||||
public function get_info($id, $recursive = true)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
if ($this->is_array($id)) {
|
||||
switch ($id['_']) {
|
||||
case 'inputUserSelf':
|
||||
case 'inputPeerSelf':
|
||||
|
@ -531,7 +531,7 @@ trait UpdateHandler
|
||||
if ($update['_'] === 'updateEncryption') {
|
||||
switch ($update['chat']['_']) {
|
||||
case 'encryptedChatRequested':
|
||||
if ($this->settings['secret_chats']['accept_chats'] === false || (is_array($this->settings['secret_chats']['accept_chats']) && !in_array($update['chat']['admin_id'], $this->settings['secret_chats']['accept_chats']))) {
|
||||
if ($this->settings['secret_chats']['accept_chats'] === false || ($this->is_array($this->settings['secret_chats']['accept_chats']) && !in_array($update['chat']['admin_id'], $this->settings['secret_chats']['accept_chats']))) {
|
||||
return;
|
||||
}
|
||||
\danog\MadelineProto\Logger::log(['Accepting secret chat '.$update['chat']['id']], \danog\MadelineProto\Logger::NOTICE);
|
||||
@ -602,7 +602,7 @@ trait UpdateHandler
|
||||
curl_close($ch);
|
||||
\danog\MadelineProto\Logger::log(['Result of webhook query is '.$result], \danog\MadelineProto\Logger::NOTICE);
|
||||
$result = json_decode($result, true);
|
||||
if (is_array($result) && isset($result['method']) && $result['method'] != '' && is_string($result['method'])) {
|
||||
if ($this->is_array($result) && isset($result['method']) && $result['method'] != '' && is_string($result['method'])) {
|
||||
\danog\MadelineProto\Logger::log(['Reverse webhook command returned', $this->method_call($result['method'], $result, ['datacenter' => $this->datacenter->curdc])]);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ trait TD
|
||||
|
||||
public function tdcli_to_td(&$params, $key = null)
|
||||
{
|
||||
if (!is_array($params)) {
|
||||
if (!$this->is_array($params)) {
|
||||
return $params;
|
||||
}
|
||||
if (!isset($params['ID'])) {
|
||||
@ -84,7 +84,7 @@ trait TD
|
||||
$newparams = ['_' => $this->reverse[$params['_']]];
|
||||
|
||||
foreach ($this->td_params_conversion[$newparams['_']] as $td => $mtproto) {
|
||||
if (is_array($mtproto)) {
|
||||
if ($this->is_array($mtproto)) {
|
||||
switch (end($mtproto)) {
|
||||
case 'choose_message_content':
|
||||
switch ($params[$td]['_']) {
|
||||
@ -100,7 +100,7 @@ trait TD
|
||||
break;
|
||||
default:
|
||||
$newparams[$mtproto[0]] = isset($params[$td]) ? $params[$td] : null;
|
||||
if (is_array($newparams[$mtproto[0]])) {
|
||||
if ($this->is_array($newparams[$mtproto[0]])) {
|
||||
$newparams[$mtproto[0]] = $this->mtproto_to_td($newparams[$mtproto[0]]);
|
||||
}
|
||||
}
|
||||
@ -117,7 +117,7 @@ trait TD
|
||||
|
||||
public function mtproto_to_td(&$params)
|
||||
{
|
||||
if (!is_array($params)) {
|
||||
if (!$this->is_array($params)) {
|
||||
return $params;
|
||||
}
|
||||
if (!isset($params['_'])) {
|
||||
@ -188,7 +188,7 @@ trait TD
|
||||
} else {
|
||||
$newparams[$td] = isset($params[$mtproto[0]]) ? $params[$mtproto[0]] : null;
|
||||
}
|
||||
if (is_array($newparams[$td])) {
|
||||
if ($this->is_array($newparams[$td])) {
|
||||
$newparams[$td] = $this->mtproto_to_td($newparams[$td]);
|
||||
}
|
||||
}
|
||||
@ -200,7 +200,7 @@ trait TD
|
||||
|
||||
public function td_to_tdcli($params)
|
||||
{
|
||||
if (!is_array($params)) {
|
||||
if (!$this->is_array($params)) {
|
||||
return $params;
|
||||
}
|
||||
$newparams = [];
|
||||
|
@ -52,4 +52,7 @@ trait Tools
|
||||
|
||||
return $d;
|
||||
}
|
||||
public function is_array($elem) {
|
||||
return is_array($elem) || (is_object($elem) && get_class($elem) === 'Volatile');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user