Skip to content

Commit dda7924

Browse files
committed
Add leak test
1 parent d6bbba4 commit dda7924

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
@@ -8,7 +8,7 @@ class Test
88

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

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)