phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.84k stars 200 forks source link

FLAG_FORCE_ARRAY affects functions #160

Closed stesie closed 9 years ago

stesie commented 9 years ago
$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");

... fails, because $func is converted to Array and hence isn't callable. Obviously the "force to array" rule shouldn't apply to functions. Just to normal objects.

stesie commented 9 years ago

Fixed by https://github.com/preillyme/v8js/commit/53995ac616588c5e988a86628f1496ff668539fc ... however with wrong issue reference :(