Annotation of embedaddon/php/ext/spl/tests/bug53071.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>