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