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, 10 months 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

    1: --TEST--
    2: Bug #60139 (Anonymous functions create cycles not detected by the GC)
    3: --INI--
    4: zend.enable_gc=1
    5: --FILE--
    6: <?php
    7: class Foo {
    8:     public $x;
    9: 
   10:     public function __construct() {
   11:         $this->x = function() {};
   12:     }
   13: }
   14: 
   15: class Bar {
   16:     public $x;
   17: 
   18:     public function __construct() {
   19:         $self = $this;
   20:         $this->x = function() use ($self) {};
   21:     }
   22: }
   23: 
   24: gc_collect_cycles();
   25: new Foo;
   26: var_dump(gc_collect_cycles());
   27: new Bar;
   28: var_dump(gc_collect_cycles());
   29: ?>
   30: --EXPECT--
   31: int(2)
   32: int(2)

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