mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-23 03:51:51 +00:00
18b129b128
Before the idle notifications to V8 were sent without a special Isolate entered, which results in V8 using it's default isolate (which we don't use at all). Hence those were pretty useless anyways (if they were called, which was unlikely). Besides V8 seems to not trigger the weak object callbacks if the isolate is destroyed, hence the PHP objects we add-ref'ed before will leak. Therefore this removes the previous idle notification logic and forces garbage collection from the V8Js object destructor.
34 lines
551 B
PHP
34 lines
551 B
PHP
--TEST--
|
|
Test V8::executeString() : Test for leaked PHP object if passed back multiple times
|
|
--SKIPIF--
|
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$js =<<< EOF
|
|
for(var i = 0; i < 1000; i ++) {
|
|
PHP.foo.getStdClassObject();
|
|
}
|
|
EOF;
|
|
|
|
class Foo {
|
|
public function getStdClassObject() {
|
|
return new stdClass();
|
|
}
|
|
|
|
public function __destruct() {
|
|
echo "destroyed\n";
|
|
}
|
|
}
|
|
|
|
$v8 = new V8Js();
|
|
$v8->foo = new Foo();
|
|
$v8->executeString($js);
|
|
unset($v8);
|
|
|
|
?>
|
|
===EOF===
|
|
--EXPECT--
|
|
destroyed
|
|
===EOF===
|