0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-14 07:18:40 +00:00
phpv8/tests/has_property_after_dispose.phpt
Christiano Becker 83431fbd52 * Added AllowDynamicPropertis on V8Js, V8Object and V8Function
* Added #[AllowDynamicProperties] on test classes that uses Dynamic Properties
2023-02-18 10:18:36 -03:00

40 lines
645 B
PHP

--TEST--
Test V8::executeString() : has_property after dispose
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
#[AllowDynamicProperties]
class Foo {
function callMe($x) {
var_dump(property_exists($x, 'bla'));
$this->x = $x;
}
}
$v8 = new V8Js();
$v8->foo = $foo = new Foo();
$JS = <<< EOT
PHP.foo.callMe({ bla: 23 });
EOT;
$v8->executeString($JS, 'basic.js');
unset($v8);
try {
var_dump(property_exists($foo->x, 'bla'));
}
catch(V8JsException $e) {
var_dump($e->getMessage());
}
?>
===EOF===
--EXPECTF--
bool(true)
string(55) "Can't access V8Object after V8Js instance is destroyed!"
===EOF===