1--TEST-- 2GC 045: Total count persisted when GC is rerun due to destructor call 3--INI-- 4zend.enable_gc=1 5--FILE-- 6<?php 7class GlobalData 8{ 9 public static Bar $bar; 10} 11 12class Value 13{ 14 public function __destruct() 15 { 16 new Bar(); 17 } 18} 19 20class Bar 21{ 22 public function __construct() 23 { 24 GlobalData::$bar = $this; 25 } 26} 27 28class Foo 29{ 30 public Foo $selfRef; 31 public Value $val; 32 33 public function __construct(Value $val) 34 { 35 $this->val = $val; 36 $this->selfRef = $this; 37 } 38} 39 40for ($j = 0; $j < 10; $j++) { 41 for ($i = 0; $i < 3000; $i++) { 42 new Foo(new Value()); 43 } 44} 45 46var_dump(gc_status()); 47?> 48--EXPECT-- 49array(4) { 50 ["runs"]=> 51 int(10) 52 ["collected"]=> 53 int(25000) 54 ["threshold"]=> 55 int(10001) 56 ["roots"]=> 57 int(10000) 58} 59