Skip to content

Commit dff3c64

Browse files
committed
Add leak test
1 parent 32635ab commit dff3c64

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Zend/tests/gh10168_3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Test
99

1010
public function __construct() {
1111
if (self::$a === null) {
12-
var_dump(self::$a = $this);
12+
var_dump(self::$a = &$this);
1313
} else {
1414
var_dump(self::$a = $this);
1515
}

Zend/tests/gh10168_5.phpt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
GH-10168 (heap-buffer-overflow at zval_undefined_cv): assign typed prop
3+
--FILE--
4+
<?php
5+
6+
class Foo {}
7+
8+
class Test
9+
{
10+
static Test|Foo|null $a = null;
11+
12+
public function __construct() {
13+
var_dump(self::$a = $this);
14+
}
15+
16+
function __destruct() {
17+
var_dump(self::$a = new Foo());
18+
}
19+
}
20+
new Test();
21+
new Test();
22+
23+
?>
24+
--EXPECT--
25+
object(Test)#1 (0) {
26+
}
27+
object(Foo)#3 (0) {
28+
}
29+
object(Test)#2 (0) {
30+
}
31+
object(Foo)#1 (0) {
32+
}

0 commit comments

Comments
 (0)