xref: /PHP-7.2/Zend/tests/bug36006.phpt (revision 610c7fbe)
1--TEST--
2Bug #36006 (Problem with $this in __destruct())
3--FILE--
4<?php
5
6class Person {
7	public $dad;
8	public function __destruct() {
9		$this->dad = null; /* no segfault if this is commented out */
10	}
11}
12
13class Dad extends Person {
14	public $son;
15	public function __construct() {
16		$this->son = new Person;
17		$this->son->dad = $this; /* no segfault if this is commented out */
18	}
19	public function __destruct() {
20		$this->son = null;
21		parent::__destruct(); /* segfault here */
22	}
23}
24
25$o = new Dad;
26unset($o);
27echo "ok\n";
28?>
29--EXPECT--
30ok
31