xref: /PHP-7.3/Zend/tests/bug63734.phpt (revision 47becbf1)
1--TEST--
2Bug #63734 (Garbage collector can free zvals that are still referenced)
3--INI--
4zend.enable_gc = 1
5--FILE--
6<?php
7class C {
8    public $ref;
9    public $ary;
10    public function __construct() {
11        $this->ref = $this;
12        $this->ary[] = 42;
13    }
14    public function __destruct() {
15        global $ary;
16        $ary[] = $this->ary[0];
17    }
18}
19
20$c = new C;
21unset($c);
22gc_collect_cycles();
23
24var_dump($ary);
25?>
26--EXPECT--
27array(1) {
28  [0]=>
29  int(42)
30}
31