File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug60139.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:36 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
Bug #60139 (Anonymous functions create cycles not detected by the GC)
--INI--
zend.enable_gc=1
--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(2)
int(2)

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