Do not assume that the position of a MultiBulkResponse iterator is 0.

This commit is contained in:
Daniele Alessandri
2012-04-27 16:13:15 +02:00
parent dc889be2a2
commit 90f37f8698
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -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;
}