mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 15:18:41 +00:00
Pass back V8Object instances, don't re-wrap
This commit is contained in:
parent
90b2b2b0b1
commit
d6394301b2
20
tests/object_passback_002.phpt
Normal file
20
tests/object_passback_002.phpt
Normal 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===
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user