xref: /PHP-7.4/Zend/tests/bug74053.phpt (revision d94b0675)
1--TEST--
2Bug #74053 (Corrupted class entries on shutdown when a destructor spawns another object)
3--FILE--
4<?php
5class b {
6    function __destruct() {
7	echo "b::destruct\n";
8    }
9}
10class a {
11    static $b;
12    static $new;
13    static $max = 10;
14    function __destruct() {
15	if (self::$max-- <= 0) return;
16	echo "a::destruct\n";
17	self::$b = new b;
18	self::$new[] = new a;
19    }
20}
21new a;
22?>
23--EXPECT--
24a::destruct
25b::destruct
26a::destruct
27b::destruct
28a::destruct
29b::destruct
30a::destruct
31b::destruct
32a::destruct
33b::destruct
34a::destruct
35b::destruct
36a::destruct
37b::destruct
38a::destruct
39b::destruct
40a::destruct
41b::destruct
42a::destruct
43b::destruct
44