0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 18:41:52 +00:00

Merge pull request #219 from stesie/fix-v8object-passback

Pass back V8Object instances, don't re-wrap
This commit is contained in:
Stefan Siegl 2016-03-25 18:18:38 +01:00
commit 21c8bd2288
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,20 @@
--TEST--
Test V8::executeString() : Object passing JS > PHP > JS
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$v8 = new V8Js();
$v8->theApiCall = function() use ($v8) {
return $v8->executeString('({ foo: 23 })');
};
$v8->executeString('var_dump(PHP.theApiCall().constructor.name);');
?>
===EOF===
--EXPECT--
string(6) "Object"
===EOF===

View File

@ -988,7 +988,7 @@ v8::Handle<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRML
} }
/* Special case, passing back object originating from JS to JS */ /* Special case, passing back object originating from JS to JS */
if (ce == php_ce_v8function) { if (ce == php_ce_v8function || ce == php_ce_v8object) {
v8js_v8object *c = (v8js_v8object *) zend_object_store_get_object(value TSRMLS_CC); v8js_v8object *c = (v8js_v8object *) zend_object_store_get_object(value TSRMLS_CC);
if(isolate != c->ctx->isolate) { if(isolate != c->ctx->isolate) {