From 3145ea03230bf3fbb1f9e8d103fc33406c19d88d Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Thu, 30 Oct 2014 22:02:13 +0000 Subject: [PATCH] Set hidden data also on already know weak objects, closes #121 --- tests/regression_121.phpt | 25 +++++++++++++++++++++++++ v8js_convert.cc | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 tests/regression_121.phpt diff --git a/tests/regression_121.phpt b/tests/regression_121.phpt new file mode 100644 index 0000000..04a0b10 --- /dev/null +++ b/tests/regression_121.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test V8::executeString() : Regression #121 Z_ADDREF_P +--SKIPIF-- + +--FILE-- +blar = new stdClass(); + +$js = <<executeString($js); +?> +===EOF=== +--EXPECT-- +Hello World! +===EOF=== diff --git a/v8js_convert.cc b/v8js_convert.cc index cd62815..92214b4 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -283,6 +283,8 @@ static void php_v8js_construct_callback(const v8::FunctionCallbackInfoweak_objects.count(value)) { // We already exported this object, hence no need to add another // ref, v8 won't give us a second weak-object callback anyways. + newobj->SetAlignedPointerInInternalField(0, ext_tmpl->Value()); + newobj->SetHiddenValue(V8JS_SYM(PHPJS_OBJECT_KEY), php_object); return; }