summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2012-05-03 19:56:49 +0800
committerXinchen Hui <laruence@php.net>2012-05-03 19:56:49 +0800
commitd74d88fbb9c29b1dd5ff05a54b72cf7c9250955c (patch)
tree50c8a2c7b8069487f1af0f34e060344f1c9aa7a0
parent75d23f571479b15e48e3f51aa6ec12759f5fef01 (diff)
downloadphp-git-d74d88fbb9c29b1dd5ff05a54b72cf7c9250955c.tar.gz
Fixed test bug #61892
-rw-r--r--Zend/tests/gc_029.phpt2
-rw-r--r--Zend/tests/gc_029_zts.phpt37
2 files changed, 39 insertions, 0 deletions
diff --git a/Zend/tests/gc_029.phpt b/Zend/tests/gc_029.phpt
index 438053414a..edd231760c 100644
--- a/Zend/tests/gc_029.phpt
+++ b/Zend/tests/gc_029.phpt
@@ -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
index 0000000000..fc77e1f3bd
--- /dev/null
+++ b/Zend/tests/gc_029_zts.phpt
@@ -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)