mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 15:11:53 +00:00
Make FLAG_FORCE_ARRAY not affect V8Function objects, #closes 160
This commit is contained in:
parent
de0931a90b
commit
53995ac616
23
tests/issue_160_basic.phpt
Normal file
23
tests/issue_160_basic.phpt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
--TEST--
|
||||||
|
Test V8::executeString() : Issue #160 V8Function affected by V8Js::FLAG_FORCE_ARRAY
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$v8 = new V8Js();
|
||||||
|
|
||||||
|
$JS = <<<EOT
|
||||||
|
(function(foo) { print(foo); });
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
$func = $v8->executeString($JS, 'test', V8Js::FLAG_FORCE_ARRAY);
|
||||||
|
|
||||||
|
var_dump($func);
|
||||||
|
$func("Test-Foo Func Call\n");
|
||||||
|
?>
|
||||||
|
===EOF===
|
||||||
|
--EXPECTF--
|
||||||
|
object(V8Function)#%d (0) {
|
||||||
|
}
|
||||||
|
Test-Foo Func Call
|
||||||
|
===EOF===
|
@ -244,7 +244,7 @@ int v8js_to_zval(v8::Handle<v8::Value> jsValue, zval *return_value, int flags, v
|
|||||||
RETVAL_ZVAL(object, 1, 0);
|
RETVAL_ZVAL(object, 1, 0);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
if ((flags & V8JS_FLAG_FORCE_ARRAY) || jsValue->IsArray()) {
|
if ((flags & V8JS_FLAG_FORCE_ARRAY && !jsValue->IsFunction()) || jsValue->IsArray()) {
|
||||||
array_init(return_value);
|
array_init(return_value);
|
||||||
return v8js_get_properties_hash(jsValue, Z_ARRVAL_P(return_value), flags, isolate TSRMLS_CC);
|
return v8js_get_properties_hash(jsValue, Z_ARRVAL_P(return_value), flags, isolate TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user