Explorar o código

Use the Z_ADDREF_P macro to increasing the refcount of PHP values assigned to V8.

Simon Best %!s(int64=12) %!d(string=hai) anos
pai
achega
a20c4b84cc
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      v8js_convert.cc

+ 2 - 1
v8js_convert.cc

@@ -385,8 +385,9 @@ static v8::Handle<v8::Value> 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 {