xref: /PHP-8.2/Zend/tests/gc_047.phpt (revision abe3673d)
1--TEST--
2GC 047: Leak after GC inside a foreach loop
3--INI--
4zend.enable_gc=1
5--FILE--
6<?php
7$a = [0, 1];
8foreach($a as &$v) {
9    $a[0] =& $a;
10    $a[1] = array();
11    $a[1][0] =& $a[1];
12    $b = 1;
13    $a =& $b;
14    gc_collect_cycles();
15    break;
16}
17var_dump(gc_collect_cycles());
18?>
19--EXPECT--
20int(2)
21