Skip to content

Instantly share code, notes, and snippets.

@dhotson
Created July 31, 2014 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhotson/4d61ec0b332614a9e723 to your computer and use it in GitHub Desktop.
Save dhotson/4d61ec0b332614a9e723 to your computer and use it in GitHub Desktop.
Pheasant patch to make tests pass in HHVM
diff --git a/lib/Pheasant/Database/Mysqli/ResultIterator.php b/lib/Pheasant/Database/Mysqli/ResultIterator.php
index 17efd64..dbcd755 100755
--- a/lib/Pheasant/Database/Mysqli/ResultIterator.php
+++ b/lib/Pheasant/Database/Mysqli/ResultIterator.php
@@ -5,7 +5,7 @@ namespace Pheasant\Database\Mysqli;
class ResultIterator implements \SeekableIterator, \Countable
{
private $_result;
- private $_position;
+ private $_position = 0;
private $_currentRow;
private $_hydrator;
@@ -67,7 +67,9 @@ class ResultIterator implements \SeekableIterator, \Countable
*/
public function current()
{
- return $this->_currentRow;
+ return $this->_currentRow
+ ? $this->_currentRow
+ : ($this->_currentRow = $this->_fetch());
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment