xref: /PHP-7.0/Zend/tests/bug68652.phpt (revision e97d5fab)
1--TEST--
2Bug #68652 (segmentation fault in destructor)
3--FILE--
4<?php
5class Foo {
6
7    private static $instance;
8    public static function getInstance() {
9        if (isset(self::$instance)) {
10            return self::$instance;
11        }
12        return self::$instance = new self();
13    }
14
15    public function __destruct() {
16        Bar::getInstance();
17    }
18}
19
20class Bar {
21
22    private static $instance;
23    public static function getInstance() {
24        if (isset(self::$instance)) {
25            return self::$instance;
26        }
27        return self::$instance = new self();
28    }
29
30    public function __destruct() {
31        Foo::getInstance();
32    }
33}
34
35
36$foo = new Foo();
37?>
38--EXPECTF--
39Fatal error: Uncaught Error: Access to undeclared static property: Bar::$instance in %sbug68652.php:%d
40Stack trace:
41#0 %s(%d): Bar::getInstance()
42#1 [internal function]: Foo->__destruct()
43#2 {main}
44  thrown in %sbug68652.php on line %d
45
46