From: eric at cosky dot com
Operating system: Windows XP SP1
PHP version: 5CVS-2003-07-13 (dev)
PHP Bug Type: Reproducible crash
Bug description: small block of code causes crash, possibly destructor related.

The following block of code will crash the PHP I installed from (and previous versions).

I've read that I should be using '&new' to gain proper use of destructors,
but it seems reasonable to say that using 'new' shouldn't cause a server
crash. Perhaps a useful thing to do would be to have a class that has a
__destruct() function produce an error if created without '&new'?

Reproduce code:
class SiteClass {
function __construct() { $this->page = new PageClass(); }
class PageClass {
function Display() {
$section = new SectionClass("PageClass::Display");
class SectionClass {
function __construct($comment) {
$this->Comment = $comment;
function __destruct() {
out($this->Comment); // this line doesn't crash PHP
out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
crashes PHP
function out($code) { return; }
$site = new SiteClass();

Expected result:

Actual result:
System alert for PHP crashing.

Edit bug report at [url][/url]
Try a CVS snapshot (php4): [url][/url]
Try a CVS snapshot (php5): [url][/url]
Fixed in CVS: [url][/url]
Fixed in release: [url][/url]
Need backtrace: [url][/url]
Try newer version: [url][/url]
Not developer issue: [url][/url]
Expected behavior: [url][/url]
Not enough info: [url][/url]
Submitted twice: [url][/url]
register_globals: [url][/url]
PHP 3 support discontinued: [url][/url]
Daylight Savings: [url][/url]
IIS Stability: [url][/url]
Install GNU Sed: [url][/url]