[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-cvs
Subject:    [PECL-CVS] com pecl/languages/v8js: Set hidden data also on already know weak objects, closes #121: 
From:       Stefan Siegl <stesie () php ! net>
Date:       2014-10-30 22:02:13
Message-ID: php-mail-d58ca554397a5f9503b4e46452a166b91836072755 () git ! php ! net
[Download RAW message or body]

Commit:    3145ea03230bf3fbb1f9e8d103fc33406c19d88d
Author:    Stefan Siegl <stesie@brokenpipe.de>         Thu, 30 Oct 2014 22:02:13 \
                +0000
Parents:   a9d7dbda4594de134a4a3bed82a42dd59e3e1bdd
Branches:  master

Link:       http://git.php.net/?p=pecl/languages/v8js.git;a=commitdiff;h=3145ea03230bf3fbb1f9e8d103fc33406c19d88d


Log:
Set hidden data also on already know weak objects, closes #121

Bugs:
https://bugs.php.net/121

Changed paths:
  A  tests/regression_121.phpt
  M  v8js_convert.cc


Diff:
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--
+<?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===
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::FunctionCallbackInfo<v8::Value  if(ctx->weak_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;
 		}


--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic