summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zend/iteratorimpl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/zend/iteratorimpl.cpp b/zend/iteratorimpl.cpp
index 2750ddb..3bd2ed7 100644
--- a/zend/iteratorimpl.cpp
+++ b/zend/iteratorimpl.cpp
@@ -82,7 +82,10 @@ void IteratorImpl::key(zend_object_iterator *iter, zval *key TSRMLS_DC)
// detach the underlying zval
zval *val = retval.detach();
-
+
+ // increment number of references of the zval (we keep a copy too)
+ Z_ADDREF_P(val);
+
// copy it to the key
ZVAL_ZVAL(key, val, 1, 1);
}