diff options
author | andrey <andrey@php.net> | 2012-05-03 15:34:24 +0200 |
---|---|---|
committer | andrey <andrey@php.net> | 2012-05-03 15:34:24 +0200 |
commit | f1f1c5c90035c8fc0d8957a1c35ebb4c9df781b6 (patch) | |
tree | 1fcb1be278dd612a74c850a18f89e4d1c88f8d5c | |
parent | 267f691a45cc18a819bc2742b87dc7eae91934bc (diff) | |
parent | e022bfe34a2701d568a2a794a8f8f4432cf798ff (diff) | |
download | php-git-f1f1c5c90035c8fc0d8957a1c35ebb4c9df781b6.tar.gz |
Merge branch 'master' of git.php.net:php-src
-rw-r--r-- | Zend/tests/gc_029.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/gc_029_zts.phpt | 37 |
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) |