Skip to content

Commit dd1cbd1

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
2 parents c8b0da6 + ed038d2 commit dd1cbd1

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Zend/tests/bug64896.phpt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--TEST--
2+
Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
3+
--XFAIL--
4+
We can not fix this bug with a significant (performace slow down) change to gc
5+
--FILE--
6+
<?php
7+
$bar = NULL;
8+
class bad
9+
{
10+
private $_private = array();
11+
12+
public function __construct()
13+
{
14+
$this->_private[] = 'php';
15+
}
16+
17+
public function __destruct()
18+
{
19+
global $bar;
20+
$bar = $this;
21+
}
22+
}
23+
24+
$foo = new stdclass;
25+
$foo->foo = $foo;
26+
$foo->bad = new bad;
27+
28+
gc_disable();
29+
30+
unserialize(serialize($foo));
31+
gc_collect_cycles();
32+
var_dump($bar);
33+
/* will output:
34+
object(bad)#4 (1) {
35+
["_private":"bad":private]=>
36+
&UNKNOWN:0
37+
}
38+
*/
39+
?>
40+
--EXPECTF--
41+
bject(bad)#%d (1) {
42+
["_private":"bad":private]=>
43+
array(1) {
44+
[0]=>
45+
string(3) "php"
46+
}
47+
}

0 commit comments

Comments
 (0)