0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 10:31:53 +00:00

Pass back V8Object instances, don't re-wrap

This commit is contained in:
Stefan Siegl 2016-03-25 17:40:23 +01:00
parent 90b2b2b0b1
commit d6394301b2
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) {