diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index f56cc004..833a73ba 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -617,7 +617,7 @@ class MTProto extends \Volatile public function getV() { - return 29; + return 30; } public function get_self() diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index cad40bfa..fd779573 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -262,7 +262,7 @@ trait TL return substr($object, 1); } if (!is_numeric($object)) { - throw new Exception('given value ('.$object.") isn't numeric"); + throw new Exception("given value isn't numeric"); } return $this->pack_signed_long($object); diff --git a/src/danog/MadelineProto/TL/TLConstructor.php b/src/danog/MadelineProto/TL/TLConstructor.php index ff779cb4..1c8bfbe1 100644 --- a/src/danog/MadelineProto/TL/TLConstructor.php +++ b/src/danog/MadelineProto/TL/TLConstructor.php @@ -45,7 +45,7 @@ class TLConstructor extends \Volatile public function find_by_type($type) { - $key = array_search($type, (array) $this->type); + $key = array_search($type, (array) $this->type, true); return ($key === false) ? false : [ 'id' => $this->id[$key], @@ -70,7 +70,7 @@ class TLConstructor extends \Volatile } } } else { - $key = array_search($predicate, (array) $this->predicate); + $key = array_search($predicate, (array) $this->predicate, true); } return ($key === false) ? false : [ @@ -83,7 +83,7 @@ class TLConstructor extends \Volatile public function find_by_id($id) { - $key = array_search($id, (array) $this->id); + $key = array_search($id, (array) $this->id, true); return ($key === false) ? false : [ 'id' => $this->id[$key], diff --git a/src/danog/MadelineProto/TL/TLMethod.php b/src/danog/MadelineProto/TL/TLMethod.php index c76cf115..925d5a12 100644 --- a/src/danog/MadelineProto/TL/TLMethod.php +++ b/src/danog/MadelineProto/TL/TLMethod.php @@ -46,7 +46,7 @@ class TLMethod extends \Volatile public function find_by_method($method) { - $key = array_search($method, (array) $this->method); + $key = array_search($method, (array) $this->method, true); return ($key === false) ? false : [ 'id' => $this->id[$key], @@ -58,7 +58,7 @@ class TLMethod extends \Volatile public function find_by_id($id) { - $key = array_search($id, (array) $this->id); + $key = array_search($id, (array) $this->id, true); return ($key === false) ? false : [ 'id' => $this->id[$key], diff --git a/src/danog/MadelineProto/Tools.php b/src/danog/MadelineProto/Tools.php index 60065dbe..05e4feb2 100644 --- a/src/danog/MadelineProto/Tools.php +++ b/src/danog/MadelineProto/Tools.php @@ -40,12 +40,12 @@ trait Tools public function __call($method, $params) { - return \danog\MadelineProto\Logger::$has_thread ? $method(...$this->array_cast_recursive($params)) : $method(...$params); + return (is_object($params[0]) || \danog\MadelineProto\Logger::$has_thread) ? $method(...$this->array_cast_recursive($params, true)) : $method(...$params); } - public function array_cast_recursive($array) + public function array_cast_recursive($array, $force = false) { - if (!\danog\MadelineProto\Logger::$has_thread) { + if (!\danog\MadelineProto\Logger::$has_thread && !$force) { return $array; } if ($this->is_array($array)) { @@ -53,7 +53,7 @@ trait Tools $array = (array) $array; } foreach ($array as $key => $value) { - $array[$key] = $this->array_cast_recursive($value); + $array[$key] = $this->array_cast_recursive($value, $force); } }