mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 14:01:53 +00:00
Merge pull request #219 from stesie/fix-v8object-passback
Pass back V8Object instances, don't re-wrap
This commit is contained in:
commit
21c8bd2288
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 */
|
||||
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);
|
||||
|
||||
if(isolate != c->ctx->isolate) {
|
||||
|
Loading…
Reference in New Issue
Block a user