mirror of
https://github.com/predis/predis.git
synced 2026-08-30 20:21:31 +00:00
Do not assume that the position of a MultiBulkResponse iterator is 0.
This commit is contained in:
@@ -81,6 +81,16 @@ abstract class MultiBulkResponse implements \Iterator, \Countable
|
||||
return $this->replySize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current position of the iterator.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPosition()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,7 @@ class MultiBulkResponseTuple extends MultiBulkResponse implements \OuterIterator
|
||||
{
|
||||
$virtualSize = count($iterator) / 2;
|
||||
$this->iterator = $iterator;
|
||||
$this->position = 0;
|
||||
$this->position = $iterator->getPosition();
|
||||
$this->current = $virtualSize > 0 ? $this->getValue() : null;
|
||||
$this->replySize = $virtualSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user