diff --git a/src/danog/MadelineProto/Loop/Update/FeedLoop.php b/src/danog/MadelineProto/Loop/Update/FeedLoop.php index c3df5359..6a1ce21c 100644 --- a/src/danog/MadelineProto/Loop/Update/FeedLoop.php +++ b/src/danog/MadelineProto/Loop/Update/FeedLoop.php @@ -136,7 +136,7 @@ class FeedLoop extends ResumableSignalLoop $this->updater->setLimit($this->state->pts() + $result); yield $this->updater->resume(); $updates = array_merge($this->incomingUpdates, $updates); - $this->incomingUpdates = null; + $this->incomingUpdates = []; continue; } if (isset($update['message']['id'], $update['message']['to_id']) && !in_array($update['_'], ['updateEditMessage', 'updateEditChannelMessage'])) { diff --git a/src/danog/MadelineProto/Loop/Update/SeqLoop.php b/src/danog/MadelineProto/Loop/Update/SeqLoop.php index 8f3d92f1..18be55a0 100644 --- a/src/danog/MadelineProto/Loop/Update/SeqLoop.php +++ b/src/danog/MadelineProto/Loop/Update/SeqLoop.php @@ -140,11 +140,11 @@ class SeqLoop extends ResumableSignalLoop } public function save($updates) { - $this->pendingWakeups = array_merge($this->pendingWakeups, yield $this->feeder->feed($updates['updates'])); + $this->pendingWakeups += yield $this->feeder->feed($updates['updates']); } public function addPendingWakeups($wakeups) { - $this->pendingWakeups = array_merge($wakeups, $this->pendingWakeups); + $this->pendingWakeups += $wakeups; } public function has_all_auth() { diff --git a/src/danog/MadelineProto/Loop/Update/UpdateLoop.php b/src/danog/MadelineProto/Loop/Update/UpdateLoop.php index a8ee1be3..5c120ccb 100644 --- a/src/danog/MadelineProto/Loop/Update/UpdateLoop.php +++ b/src/danog/MadelineProto/Loop/Update/UpdateLoop.php @@ -98,7 +98,7 @@ class UpdateLoop extends ResumableSignalLoop $difference['pts'] = $state->pts() + 1; } $state->update($difference); - $result = array_merge($result, yield $feeder->feed($difference['other_updates'])); + $result += yield $feeder->feed($difference['other_updates']); $feeder->saveMessages($difference['new_messages']); if (!$difference['final']) { @@ -134,8 +134,8 @@ class UpdateLoop extends ResumableSignalLoop foreach ($difference['new_encrypted_messages'] as &$encrypted) { $encrypted = ['_' => 'updateNewEncryptedMessage', 'message' => $encrypted]; } - $result = array_merge($result, yield $feeder->feed($difference['other_updates'])); - $result = array_merge($result, yield $feeder->feed($difference['new_encrypted_messages'])); + $result += yield $feeder->feed($difference['other_updates']); + $result += yield $feeder->feed($difference['new_encrypted_messages']); $feeder->saveMessages($difference['new_messages']); $state->update($difference['state']); unset($difference); @@ -144,8 +144,8 @@ class UpdateLoop extends ResumableSignalLoop foreach ($difference['new_encrypted_messages'] as &$encrypted) { $encrypted = ['_' => 'updateNewEncryptedMessage', 'message' => $encrypted]; } - $result = array_merge($result, yield $feeder->feed($difference['other_updates'])); - $result = array_merge($result, yield $feeder->feed($difference['new_encrypted_messages'])); + $result += yield $feeder->feed($difference['other_updates']); + $result += yield $feeder->feed($difference['new_encrypted_messages']); $feeder->saveMessages($difference['new_messages']); $state->update($difference['intermediate_state']); if ($difference['intermediate_state']['pts'] >= $toPts) { diff --git a/src/danog/MadelineProto/MTProtoTools/ResponseHandler.php b/src/danog/MadelineProto/MTProtoTools/ResponseHandler.php index b23ccc62..189b56f3 100644 --- a/src/danog/MadelineProto/MTProtoTools/ResponseHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/ResponseHandler.php @@ -580,7 +580,7 @@ trait ResponseHandler $update['_'] === 'updateEditMessage' || $update['_'] === 'updateDeleteMessages' || $update['_'] === 'updateReadHistoryInbox' || $update['_'] === 'updateReadHistoryOutbox' || $update['_'] === 'updateWebPage' || $update['_'] === 'updateMessageID') { - $result[yield $this->feeder[false]->feedSingle($update)] = true; + $result[yield $this->feeders[false]->feedSingle($update)] = true; unset($updates['updates'][$key]); } } @@ -596,7 +596,7 @@ trait ResponseHandler $this->seqUpdater->resume(); break; case 'updateShort': - $this->feeders[yield $this->feeder[false]->feedSingle($update)]->resume(); + $this->feeders[yield $this->feeders[false]->feedSingle($updates['update'])]->resume(); break; case 'updateShortMessage': case 'updateShortChatMessage':