xref: /PHP-8.2/Zend/tests/bug64720.phpt (revision 782352c5)
1--TEST--
2Bug #64720 (SegFault on zend_deactivate)
3--FILE--
4<?php
5class Stat {
6    private static $requests;
7    public static function getInstance() {
8        if (!isset(self::$requests[1])) {
9            self::$requests[1] = new self();
10        }
11        return self::$requests[1];
12    }
13
14    public function __destruct() {
15        unset(self::$requests[1]);
16    }
17}
18
19class Foo {
20    public function __construct() {
21        Stat::getInstance();
22    }
23}
24
25class ErrorTest {
26    private $trace;
27    public function __construct() {
28        $this->trace = debug_backtrace(1);
29    }
30}
31
32class Bar {
33    public function __destruct() {
34        Stat::getInstance();
35        new ErrorTest();
36    }
37
38    public function test() {
39        new ErrorTest();
40    }
41}
42
43$foo = new Foo();
44$bar = new Bar();
45$bar->test();
46?>
47OK
48--EXPECT--
49OK
50