From ec8444cfda09986d0a9eaef10dc98443842fe3a9 Mon Sep 17 00:00:00 2001 From: Patrick Reilly Date: Thu, 9 May 2013 15:43:27 -0700 Subject: [PATCH] Use the Z_ADDREF_P macro to increasing the refcount of PHP values assigned to V8 --- v8js_convert.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v8js_convert.cc b/v8js_convert.cc index bc0e92c..75d879c 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -384,9 +384,9 @@ static v8::Handle php_v8js_hash_to_jsobj(zval *value TSRMLS_DC) /* {{ newobj->SetHiddenValue(V8JS_SYM(ZEND_ISSET_FUNC_NAME), PHP_V8JS_CALLBACK(isset_ptr)); } } - + // 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 {