mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 15:18:41 +00:00
Set hidden data also on already know weak objects, closes #121
This commit is contained in:
parent
a9d7dbda45
commit
3145ea0323
25
tests/regression_121.phpt
Normal file
25
tests/regression_121.phpt
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
--TEST--
|
||||||
|
Test V8::executeString() : Regression #121 Z_ADDREF_P
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$v8 = new V8Js();
|
||||||
|
$v8->blar = new stdClass();
|
||||||
|
|
||||||
|
$js = <<<EOT
|
||||||
|
PHP.blar.blub = {}
|
||||||
|
PHP.blar.blub['foo'] = 23;
|
||||||
|
PHP.blar.blub['bar'] = 5;
|
||||||
|
PHP.blar.blub['baz'] = 42;
|
||||||
|
|
||||||
|
print("Hello World!\\n");
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
$v8->executeString($js);
|
||||||
|
?>
|
||||||
|
===EOF===
|
||||||
|
--EXPECT--
|
||||||
|
Hello World!
|
||||||
|
===EOF===
|
@ -283,6 +283,8 @@ static void php_v8js_construct_callback(const v8::FunctionCallbackInfo<v8::Value
|
|||||||
if(ctx->weak_objects.count(value)) {
|
if(ctx->weak_objects.count(value)) {
|
||||||
// We already exported this object, hence no need to add another
|
// We already exported this object, hence no need to add another
|
||||||
// ref, v8 won't give us a second weak-object callback anyways.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user