Skip to content

Commit 94d99c3

Browse files
committed
fix each() start key
foreach($cursor as $i => $v) exit($i); #return 1 -> bug ...
1 parent 8b1efe5 commit 94d99c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/BatchQueryResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function next()
107107
if ($this->query->indexBy !== null) {
108108
$this->_key = key($this->_batch);
109109
} elseif (key($this->_batch) !== null) {
110-
$this->_key++;
110+
$this->_key = $this->_key === null ? 0 : $this->_key + 1;
111111
} else {
112112
$this->_key = null;
113113
}

0 commit comments

Comments
 (0)