xref: /php-src/Zend/tests/bug39346.phpt (revision f8d79582)
1--TEST--
2Bug #39346 (Unsetting a static variable inside a destructor causes segfault later on)
3--FILE--
4<?php
5class test
6{
7    protected $_id;
8    static $instances;
9
10    public function __construct($id) {
11        $this->_id = $id;
12        self::$instances[$this->_id] = $this;
13    }
14
15    function __destruct() {
16        unset(self::$instances[$this->_id]);
17    }
18}
19$test = new test(2);
20$test = new test(1);
21$test = new test(2);
22$test = new test(3);
23echo "ok\n";
24?>
25--EXPECT--
26ok
27