Return to bug47343.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests |
1.1 ! misho 1: --TEST-- ! 2: Bug #47343 (gc_collect_cycles causes a segfault when called within a destructor in one case) ! 3: --FILE-- ! 4: <?php ! 5: class A ! 6: { ! 7: public function __destruct() ! 8: { ! 9: gc_collect_cycles(); ! 10: } ! 11: ! 12: public function getB() ! 13: { ! 14: $this->data['foo'] = new B($this); ! 15: $this->data['bar'] = new B($this); ! 16: // Return either of the above ! 17: return $this->data['foo']; ! 18: } ! 19: } ! 20: ! 21: class B ! 22: { ! 23: public function B($A) ! 24: { ! 25: $this->A = $A; ! 26: } ! 27: ! 28: public function __destruct() ! 29: { ! 30: } ! 31: } ! 32: ! 33: for ($i = 0; $i < 2; $i++) ! 34: { ! 35: $Aobj = new A; ! 36: $Bobj = $Aobj->getB(); ! 37: unset($Bobj); ! 38: unset($Aobj); ! 39: } ! 40: ! 41: echo "DONE\n"; ! 42: ?> ! 43: --EXPECT-- ! 44: DONE