xref: /PHP-8.1/Zend/tests/bug51822.phpt (revision f8d79582)
1--TEST--
2Bug #51822 (Segfault with strange __destruct() for static class variables)
3--FILE--
4<?php
5class DestructableObject
6{
7    public function __destruct()
8    {
9        echo "2\n";
10    }
11}
12
13class DestructorCreator
14{
15    public function __destruct()
16    {
17        $this->test = new DestructableObject;
18        echo "1\n";
19    }
20}
21
22class Test
23{
24    public static $mystatic;
25}
26
27// Uncomment this to avoid segfault
28//Test::$mystatic = new DestructorCreator();
29
30$x = new Test();
31
32if (!isset(Test::$mystatic))
33    Test::$mystatic = new DestructorCreator();
34
35echo "bla\n";
36?>
37--EXPECT--
38bla
391
402
41