diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-21 10:03:12 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-21 10:03:12 +0100 |
commit | e9532c9d76f880a0b43bd86bdf1d85dd13157c5a (patch) | |
tree | e10131947578c816a24b416dcc16a0082f7197d8 /src | |
parent | e7faad695a7dae3f6ca07f3746d4577c2e8745d6 (diff) |
fixed some issues with traverse iterators
Diffstat (limited to 'src')
-rw-r--r-- | src/traverseiterator.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/traverseiterator.h b/src/traverseiterator.h index 1b12650..4fbfe2f 100644 --- a/src/traverseiterator.h +++ b/src/traverseiterator.h @@ -40,7 +40,7 @@ public: _iter->funcs->rewind(_iter); // is the iterator at a valid position? - if (_iter->funcs->valid(_iter)) return; + if (_iter->funcs->valid(_iter) != FAILURE) return; // reset the iterator _iter->funcs->dtor(_iter); @@ -84,7 +84,7 @@ public: virtual bool increment() override { // do we still have an iterator? - if (_iter) return false; + if (!_iter) return false; // movw it forward _iter->funcs->move_forward(_iter); @@ -100,6 +100,7 @@ public: virtual bool decrement() override { // not possible with PHP iterators + throw Exception("Impossible to iterate backwards"); } /** @@ -162,7 +163,7 @@ private: if (!_iter) return false; // is the iterator at a valid position? - if (_iter->funcs->valid(_iter)) + if (_iter->funcs->valid(_iter) != FAILURE) { // we need to read the current key and value // @todo implementation for php 5.3 and php 5.4 and higher |