-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathissue_250_001.phpt
64 lines (51 loc) · 1.3 KB
/
issue_250_001.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--TEST--
Test V8::executeString() : Issue #250 (early free of array)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
#[AllowDynamicProperties]
class TestObject {
private $data = [];
private $meta = [];
public function setTitle($title) {
$this->a->b->title = $title;
}
public function getData() {
return $this->data;
}
public function getMeta() {
return $this->meta;
}
public function setData($data=[]) {
$this->data = $data;
}
public function setMeta($meta) {
return;
}
}
$v8 = new V8Js("server");
$code = <<< EOT
var v1 = server.response.getData();
var v2 = server.response.getMeta();
server.response.setData({});
server.response.setTitle("ouch");
server.response.setMeta({});
EOT;
$response = new TestObject();
$v8->response = $response;
try {
$result = $v8->executeString($code);
var_dump($v8->response);
} catch (V8JsException $e) {
var_dump($e);
}
?>
===EOF===
--EXPECTF--
Fatal error: Uncaught Error: Attempt to modify property "b" on null in %s%eissue_250_001.php:10
Stack trace:
#0 [internal function]: TestObject->setTitle('ouch')
#1 %s%eissue_250_001.php(45): V8Js->executeString(' var v1 = se...')
#2 {main}
thrown in %s%eissue_250_001.php on line 10