From 94d99c3b10ec788ed146034df729559c08cbf542 Mon Sep 17 00:00:00 2001 From: Ziaratban Date: Tue, 11 Feb 2020 11:04:02 +0330 Subject: [PATCH] fix each() start key foreach($cursor as $i => $v) exit($i); #return 1 -> bug ... --- src/BatchQueryResult.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BatchQueryResult.php b/src/BatchQueryResult.php index 23f268959..3600a9c1d 100644 --- a/src/BatchQueryResult.php +++ b/src/BatchQueryResult.php @@ -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; }