xref: /PHP-5.6/Zend/tests/bug64896.phpt (revision 6c48c6bc)
1--TEST--
2Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
3--XFAIL--
4We can not fix this bug without a significant (performace slow down) change to gc
5--FILE--
6<?php
7$bar = NULL;
8class 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
28gc_disable();
29
30unserialize(serialize($foo));
31gc_collect_cycles();
32var_dump($bar);
33/*  will output:
34object(bad)#4 (1) {
35  ["_private":"bad":private]=>
36  &UNKNOWN:0
37}
38*/
39?>
40--EXPECTF--
41bject(bad)#%d (1) {
42  ["_private":"bad":private]=>
43  array(1) {
44    [0]=>
45    string(3) "php"
46  }
47}
48