1--TEST-- 2Bug #67387: Circular references in SPL iterators are not garbage collected 3--FILE-- 4<?php 5 6$it = new ArrayIterator([1, 2, 3]); 7// Inner. 8$it[] = $it; 9 10// Callback 11$it2 = new CallbackFilterIterator($it, function($elem) use(&$it2) { 12 return true; 13}); 14 15// Callback object 16new class { 17 public function __construct() { 18 $it = new ArrayIterator([1, 2, 3]); 19 $this->it = new CallbackFilterIterator($it, function($elem) { 20 return true; 21 }); 22 } 23}; 24 25// Recursive callback 26$it = new RecursiveArrayIterator([1, 2, 3]); 27$it2 = new RecursiveCallbackFilterIterator($it, function($elem) use(&$it2) { 28 return true; 29}); 30 31// Cache 32$it = new ArrayIterator(); 33$it2 = new CachingIterator($it, CachingIterator::FULL_CACHE); 34$it2[] = $it2; 35$it2->next(); 36 37// Recursive cache 38$it = new RecursiveArrayIterator(); 39$it2 = new RecursiveCachingIterator($it, CachingIterator::FULL_CACHE); 40$it2[] = $it2; 41$it2->next(); 42 43// Append 44$it = new ArrayIterator(); 45$it2 = new AppendIterator(); 46$it[] = $it2; 47$it2->append($it); 48 49?> 50===DONE=== 51--EXPECT-- 52===DONE=== 53