xref: /PHP-8.3/Zend/tests/gc_046.phpt (revision 33918f99)
1--TEST--
2GC 046: Leak in User Iterator
3--INI--
4zend.enable_gc=1
5--FILE--
6<?php
7class Action {
8    private $iterator;
9    function __construct() {
10        $this->iterator = new ArrayIterator($this);
11    }
12    function filter() {
13        $this->iterator = new CallbackFilterIterator($this->iterator, fn() => true);
14        $this->iterator->rewind();
15    }
16}
17
18$action=new Action;
19$action->filter();
20$action->filter();
21?>
22DONE
23--EXPECT--
24DONE
25