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.83k stars 200 forks source link

call_user_func fails on V8Object methods #118

Closed stesie closed 8 years ago

stesie commented 9 years ago
<?php

$v8 = new V8Js();
$a = $v8->executeString('var a = { bla: function() { print("Hallo\\n"); } }; a');
var_dump($a);

call_user_func(array($a, 'bla'));
Program received signal SIGSEGV, Segmentation fault.
0x000000000070cc79 in gc_zval_possible_root ()
(gdb) bt
#0  0x000000000070cc79 in gc_zval_possible_root ()
#1  0x00000000006f9f75 in ?? ()
#2  0x00000000006fb778 in zend_hash_graceful_reverse_destroy ()
#3  0x00000000006de1e6 in shutdown_executor ()
#4  0x00000000006ed9e2 in zend_deactivate ()
#5  0x000000000068de2d in php_request_shutdown ()
#6  0x000000000079eb7a in ?? ()
#7  0x0000000000461de0 in main ()

after all this is very strange, since a direct call to $a->bla() works ...

stesie commented 9 years ago

This is a reference counting bug, triggered in the PHP/Zend engine. I've forwarded this to https://bugs.php.net/bug.php?id=68358 a while ago.

stesie commented 8 years ago

Cannot reproduce with PHP7, hence rejecting.