#36828 [NEW]: segfault in special __destruct circumstances
| From: | locke at pushby dot com | Date: | Thu, 23 Mar 2006 00:58:14 +0000 |
| Subject: | #36828 [NEW]: segfault in special __destruct circumstances | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-94792@lists.php.net to get a copy of this message | ||
From: locke at pushby dot com
Operating system: Multiple: FreeBSD,Linux,Windows
PHP version: 5.1.2
PHP Bug Type: Reproducible crash
Bug description: segfault in special __destruct circumstances
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 bug report at http://bugs.php.net/?id=36828&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36828&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36828&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36828&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36828&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36828&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36828&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36828&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36828&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36828&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36828&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36828&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36828&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36828&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36828&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36828&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36828&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36828&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36828&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36828&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36828&r=mysqlcfg