#36006 [NEW]: Problem with $this in __destruct()

From: Date: Sat, 14 Jan 2006 00:13:33 +0000
Subject: #36006 [NEW]: Problem with $this in __destruct()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91884@lists.php.net to get a copy of this message
From: php_nospam at ramihyn dot sytes dot net Operating system: Windows, Debian Sarge PHP version: 5.1.2 PHP Bug Type: Scripting Engine problem Bug description: Problem with $this in __destruct() Description: ------------ segfault caused by setting properties to null in __destruct() Reproduce code: --------------- <?php class Person { public $dad; public function __destruct() { $this->dad = null; /* no segfault if this is commented out */ } } class Dad extends Person { public $son; public function __construct() { $this->son = new Person; $this->son->dad = $this; /* no segfault if this is commented out */ } public function __destruct() { $this->son = null; parent::__destruct(); /* segfault here */ } } $o = new Dad; unset($o); ?> Expected result: ---------------- No segfault Actual result: -------------- PHP crashes due to a segfault (crashes apache worker thread when running as apache module) -- Edit bug report at http://bugs.php.net/?id=36006&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36006&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36006&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36006&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36006&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36006&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36006&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36006&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36006&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36006&r=support Expected behavior: http://bugs.php.net/fix.php?id=36006&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36006&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36006&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36006&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36006&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36006&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36006&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36006&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36006&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36006&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36006&r=mysqlcfg

« previous php.bugs (#91884) next »