Skip to content

Commit

Permalink
fix each() start key
Browse files Browse the repository at this point in the history
foreach($cursor as $i => $v)
   exit($i); #return 1   -> bug ...
  • Loading branch information
ziaratban committed Feb 14, 2020
1 parent 837c14c commit d3853fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/BatchQueryResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function next()
if ($this->query->indexBy !== null) {
$this->_key = key($this->_batch);
} elseif (key($this->_batch) !== null) {
$this->_key++;
$this->_key = $this->_key === null ? 0 : $this->_key + 1;
} else {
$this->_key = null;
}
Expand Down

0 comments on commit d3853fc

Please sign in to comment.