File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug60139.phpt
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 2 months ago) by misho
CVS tags: MAIN, HEAD
Initial revision

--TEST--
Bug #60139 (Anonymous functions create cycles not detected by the GC)
--FILE--
<?php
class Foo {
    public $x;

    public function __construct() {
        $this->x = function() {};
    }
}

class Bar {
    public $x;

    public function __construct() {
        $self = $this;
        $this->x = function() use ($self) {};
    }
}

gc_collect_cycles();
new Foo;
var_dump(gc_collect_cycles());
new Bar;
var_dump(gc_collect_cycles());
?>
--EXPECT--
int(0)
int(2)

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