]> granicus.if.org Git - php/commitdiff
Fixed test bug #61892
authorXinchen Hui <laruence@php.net>
Thu, 3 May 2012 11:56:49 +0000 (19:56 +0800)
committerXinchen Hui <laruence@php.net>
Thu, 3 May 2012 11:56:49 +0000 (19:56 +0800)
Zend/tests/gc_029.phpt
Zend/tests/gc_029_zts.phpt [new file with mode: 0644]

index 438053414a80ce3eb3e086c929d0e70a974fc34d..edd231760c653d0277c2e6ea100822d14ae18e39 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 GC 029: GC and destructors
+--SKIPIF--
+<?php if (PHP_ZTS) { print "skip only for no-zts build"; }
 --INI--
 zend.enable_gc=1
 --FILE--
diff --git a/Zend/tests/gc_029_zts.phpt b/Zend/tests/gc_029_zts.phpt
new file mode 100644 (file)
index 0000000..fc77e1f
--- /dev/null
@@ -0,0 +1,37 @@
+--TEST--
+GC 029: GC and destructors
+--SKIPIF-- 
+<?php if (!PHP_ZTS) { print "skip only for zts build"; }
+--INI--
+zend.enable_gc=1
+--FILE--
+<?php
+class Foo {
+       public $bar;
+       public $x = array(1,2,3);
+       function __destruct() {
+               if ($this->bar !== null) {
+                       $this->x = null;
+                       unset($this->bar);
+               }
+       }
+}
+class Bar {
+       public $foo;
+        function __destruct() {
+                if ($this->foo !== null) {
+                        unset($this->foo);
+                }
+        }
+
+}
+$foo = new Foo();
+$bar = new Bar();
+$foo->bar = $bar;
+$bar->foo = $foo;
+unset($foo);
+unset($bar);
+var_dump(gc_collect_cycles());
+?>
+--EXPECT--
+int(3)