fix zend_object_iterator.key with PHP-5.5
authorMichael Wallner <mike@php.net>
Thu, 21 Mar 2013 16:31:20 +0000 (17:31 +0100)
committerMichael Wallner <mike@php.net>
Thu, 21 Mar 2013 16:31:20 +0000 (17:31 +0100)
php_pq.c

index 46088498357cb0bc8304ea3e07e96b46c216a591..40d7c649cc0d9fccb57c2abaead998b86aca0a29 100644 (file)
--- a/php_pq.c
+++ b/php_pq.c
@@ -479,6 +479,14 @@ static void php_pqres_iterator_current(zend_object_iterator *i, zval ***data_ptr
        *data_ptr = &iter->current_val;
 }
 
+#if PHP_VERSION_ID >= 50500
+static void php_pqres_iterator_key(zend_object_iterator *i, zval *key TSRMLS_DC)
+{
+       php_pqres_iterator_t *iter = (php_pqres_iterator_t *) i;
+
+       ZVAL_LONG(key, iter->index);
+}
+#else
 static int php_pqres_iterator_key(zend_object_iterator *i, char **key_str, uint *key_len, ulong *key_num TSRMLS_DC)
 {
        php_pqres_iterator_t *iter = (php_pqres_iterator_t *) i;
@@ -487,6 +495,7 @@ static int php_pqres_iterator_key(zend_object_iterator *i, char **key_str, uint
 
        return HASH_KEY_IS_LONG;
 }
+#endif
 
 static void php_pqres_iterator_invalidate(zend_object_iterator *i TSRMLS_DC)
 {