xref: /PHP-8.2/Zend/tests/bug35239.phpt (revision 782352c5)
1--TEST--
2Bug #35239 (Objects can lose references)
3--FILE--
4<?php
5$a = new stdClass;
6$a->x0 = new stdClass;
7$a->x0->y0 = 'a';
8$a->x0->y1 =& $a->x0;
9$a->x0->y2 =& $a->x0;
10$a->x0->y0 = 'b';
11var_dump($a);
12$a->x0->y1 = "ok\n";
13echo $a->x0;
14?>
15--EXPECTF--
16object(stdClass)#%d (1) {
17  ["x0"]=>
18  &object(stdClass)#%d (3) {
19    ["y0"]=>
20    string(1) "b"
21    ["y1"]=>
22    *RECURSION*
23    ["y2"]=>
24    *RECURSION*
25  }
26}
27ok
28