xref: /PHP-8.1/Zend/tests/bug72530.phpt (revision 60a7e60b)
1--TEST--
2Bug #72530: Use After Free in GC with Certain Destructors
3--FILE--
4<?php
5
6class ryat {
7    var $ryat;
8    var $chtg;
9
10    function __destruct() {
11        $this->chtg = $this->ryat;
12        $this->ryat = 1;
13    }
14}
15
16$o = new ryat;
17$o->ryat = $o;
18$x =& $o->chtg;
19
20unset($o);
21gc_collect_cycles();
22var_dump($x);
23
24?>
25--EXPECT--
26object(ryat)#1 (2) {
27  ["ryat"]=>
28  int(1)
29  ["chtg"]=>
30  *RECURSION*
31}
32