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.

Description:
------------
The following block of code will crash the PHP I installed from
php5-win32-200307130630.zip (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();
$site->page->Display();

Expected result:
----------------
Nothing.

Actual result:
--------------
System alert for PHP crashing.

--
Edit bug report at [url]http://bugs.php.net/?id=24635&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=24635&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=24635&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=24635&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=24635&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=24635&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=24635&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=24635&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=24635&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=24635&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=24635&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=24635&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=24635&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=24635&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=24635&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=24635&r=gnused[/url]