xref: /PHP-8.3/Zend/tests/bug24635.phpt (revision 1b120b4a)
1--TEST--
2Bug #24635 (crash on dtor calling other functions)
3--FILE--
4<?php
5class SiteClass {
6    public $page;
7    function __construct()	{ $this->page = new PageClass(); }
8}
9class PageClass {
10    function Display() {
11        $section = new SectionClass("PageClass::Display");
12    }
13}
14class SectionClass {
15    public $Comment;
16    function __construct($comment) {
17        $this->Comment = $comment;
18    }
19    function __destruct() {
20        out($this->Comment); // this line doesn't crash PHP
21        out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
22    }
23}
24function out($code) { return; }
25$site = new SiteClass();
26$site->page->Display();
27echo "OK\n";
28?>
29--EXPECT--
30OK
31