xref: /PHP-8.1/Zend/tests/bug78379.phpt (revision 9ed2f489)
1--TEST--
2Bug #78379 (Cast to object confuses GC, causes crash)
3--FILE--
4<?php
5class C {
6    public function __construct() {
7        $this->p = (object)["x" => [1]];
8    }
9}
10class E {
11}
12$e = new E;
13$e->f = new E;
14$e->f->e = $e;
15$e->a = new C;
16$e = null;
17gc_collect_cycles();
18var_dump(new C);
19?>
20--EXPECTF--
21object(C)#%d (1) {
22  ["p"]=>
23  object(stdClass)#%d (1) {
24    ["x"]=>
25    array(1) {
26      [0]=>
27      int(1)
28    }
29  }
30}
31