blob: d5926b28f06b8f7b2f1e189d4537ab02d1795323 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
--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)
|