0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 20:51:51 +00:00
phpv8/tests/issue_250_002.phpt
2016-08-12 01:02:56 +02:00

45 lines
740 B
PHP

--TEST--
Test V8::executeString() : Issue #250 (early free of array)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
class TestObject {
var $data;
public function setData($data) {
$this->data = $data;
}
public function getData() {
return $this->data;
}
}
$v8 = new V8Js("server");
$code = <<< EOT
server.response.setData({"new": true});
EOT;
$v8->response = new TestObject();
try {
$result = $v8->executeString($code, null, \V8Js::FLAG_FORCE_ARRAY | \V8Js::FLAG_PROPAGATE_PHP_EXCEPTIONS);
var_dump($v8->response->getData());
} catch (V8JsException $e) {
var_dump($e);
}
?>
===EOF===
--EXPECT--
array(1) {
["new"]=>
bool(true)
}
===EOF===