summaryrefslogtreecommitdiff
path: root/Zend/tests/bug60139.phpt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2011-11-02 06:31:33 +0000
committerDmitry Stogov <dmitry@php.net>2011-11-02 06:31:33 +0000
commitb64e91ddebdb0c33d7b6bf4dc93aae39308e67ce (patch)
tree635f81f2864052e902e450875a9d7cc665c42f11 /Zend/tests/bug60139.phpt
parent0bf1d9eac7bb12497eb72824257e95b4ce21d644 (diff)
downloadphp-git-b64e91ddebdb0c33d7b6bf4dc93aae39308e67ce.tar.gz
Fixed bug #60139 (Anonymous functions create cycles not detected by the GC)
Diffstat (limited to 'Zend/tests/bug60139.phpt')
-rw-r--r--Zend/tests/bug60139.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/Zend/tests/bug60139.phpt b/Zend/tests/bug60139.phpt
new file mode 100644
index 0000000000..414fa56516
--- /dev/null
+++ b/Zend/tests/bug60139.phpt
@@ -0,0 +1,30 @@
+--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(2)
+int(2)