get_updates fix

This commit is contained in:
Daniil Gentili 2018-12-26 22:46:10 +00:00
parent 495e543238
commit a2fc5e9c94

View File

@ -88,12 +88,7 @@ trait UpdateHandler
$params['offset'] = array_reverse(array_keys((array) $this->updates))[abs($params['offset']) - 1];
}
$updates = [];
if (isset($this->updates["\0*\0state"])) {
unset($this->updates["\0*\0state"]);
}
$supdates = (array) $this->updates;
ksort($supdates);
foreach ($supdates as $key => $value) {
foreach ($this->updates as $key => $value) {
if ($params['offset'] > $key) {
unset($this->updates[$key]);
} elseif ($params['limit'] === null || count($updates) < $params['limit']) {
@ -101,10 +96,6 @@ trait UpdateHandler
}
}
if (empty($this->updates)) {
$this->updates_key = 0;
}
return $updates;
}