From d2e10c764d1b8860dd798eda3055fc957ff556ad Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Mon, 10 Mar 2014 10:39:22 +0100 Subject: fixed iterators for php 5.3 + updated documentation about iterators --- include/iterator.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include') diff --git a/include/iterator.h b/include/iterator.h index 3c8f870..0c64133 100644 --- a/include/iterator.h +++ b/include/iterator.h @@ -73,6 +73,16 @@ private: */ Value _object; + /** + * The current() method that is called by the Zend engine wants a + * pointer-to-pointer-to-a-zval. Because of this, we have to keep the + * current value in memory after the current() method returns because + * the pointer would otherwise fall out of scope. This is (once again) + * odd behavior of the Zend engine, but we'll have to live with that + * @var Value + */ + Value _current; + /** * Internal method that returns the implementation object * @return zend_object_iterator @@ -110,6 +120,16 @@ private: */ static void key(struct _zend_object_iterator *iter, struct _zval_struct *data); + /** + * Function to retrieve the current key, php 5.3 style + * @param iter + * @param str_key + * @param str_key_len + * @param int_key + * @return HASH_KEY_IS_STRING or HASH_KEY_IS_LONG + */ + static int key(struct _zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key); + /** * Step forwards to the next element * @param iter -- cgit v1.2.3