xref: /PHP-8.2/Zend/tests/gc_042.phpt (revision 902d6439)
1--TEST--
2Object properties HT may need to be removed from nested data
3--FILE--
4<?php
5
6#[AllowDynamicProperties]
7class Test {
8    public function __destruct() {
9        $GLOBALS['x'] = $this;
10    }
11}
12
13$t = new Test;
14$t->x = new stdClass;
15$t->x->t = $t;
16$a = (array) $t->x;
17unset($t, $a);
18gc_collect_cycles();
19var_dump($x);
20
21?>
22--EXPECT--
23object(Test)#1 (1) {
24  ["x"]=>
25  object(stdClass)#2 (1) {
26    ["t"]=>
27    *RECURSION*
28  }
29}
30