xref: /PHP-5.6/ext/spl/tests/bug53071.phpt (revision 950d3d6e)
1--TEST--
2Bug #53071 (Usage of SPLObjectStorage defeats gc_collect_cycles)
3--FILE--
4<?php
5gc_enable();
6class myClass
7{
8	public $member;
9}
10function LimitedScope()
11{
12	$myA = new myClass();
13	$myB = new SplObjectStorage();
14	$myC = new myClass();
15	$myC->member = $myA; // myC has a reference to myA
16	$myB->Attach($myC);  // myB attaches myC
17	$myA->member = $myB; // myA has myB, comleting the cycle
18}
19LimitedScope();
20var_dump(gc_collect_cycles());
21
22echo "Done.\n";
23
24?>
25--EXPECTF--
26int(4)
27Done.
28