From 79444ce76aff359cf32d737b4532388d69b741f8 Mon Sep 17 00:00:00 2001 From: Simon Best Date: Sun, 24 Mar 2013 16:30:21 +0000 Subject: [PATCH] Use the Z_ADDREF_P macro to increasing the refcount of PHP values assigned to V8. --- v8js_convert.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v8js_convert.cc b/v8js_convert.cc index 41763ff..22b0cbb 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -385,8 +385,9 @@ static v8::Handle php_v8js_hash_to_jsobj(zval *value TSRMLS_DC) /* {{ } } + // Increase the reference count of this value because we're storing it internally for use later // See https://github.com/preillyme/v8js/issues/6 - Z_SET_REFCOUNT_P(value, Z_REFCOUNT_P(value) + 1); + Z_ADDREF_P(value); newobj->SetAlignedPointerInInternalField(0, (void *) value); } else {