ID: 36828 Comment by: judas dot iscariote at gmail dot com Reported By: locke at pushby dot com Status: Open Bug Type: Reproducible crash Operating System: Multiple: FreeBSD,Linux,Windows PHP Version: 5.1.2 New Comment:
# php5-debug destruct.php MESSAGE: ACK PHP 5.1.3RC2-dev (cli) (built: Mar 22 2006 21:01:28) (DEBUG) no segfault , works as you expected. Previous Comments: ------------------------------------------------------------------------ [2006-03-23 01:58:13] locke at pushby dot com Description: ------------ Segfault occurs in object destructor when a number of conditions appear together. See code comment for details. This might be related to bug #36006 (http://bugs.php.net/bug.php?id=36006), but it isn't clear since commenting out *either* of the two lines indicated in the code below avoids the segfault. Reproduce code: --------------- <?php class segfault { protected $message = null; protected $foo = null; public function __construct ($message) { $this->foo = new foo ($this); $this->message = $message; } public function __destruct () { // If *either* of the following two lines are omitted, we don't segfault ... unset($this->foo); print( "MESSAGE: $this->message \n" ); } } class foo { protected $ob_ref = null; public function __construct ($ob_ref) { $this->ob_ref = $ob_ref; } } $segf = new segfault("ACK"); unset($segf); ?> Expected result: ---------------- Code prints: "MESSAGE: ACK" Actual result: -------------- No message is printed. PHP terminates with Segmentation Fault (or Bus error depending on the hardware). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36828&edit=1