#31894 [NEW]: Calling restore_error_handler inside destructor crashes PHP
| From: | adove at mindrage dot com | Date: | Wed, 09 Feb 2005 11:24:29 +0000 |
| Subject: | #31894 [NEW]: Calling restore_error_handler inside destructor crashes PHP | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-73696@lists.php.net to get a copy of this message | ||
From: adove at mindrage dot com
Operating system: WinXP
PHP version: 5.0.3
PHP Bug Type: Zend Engine 2 problem
Bug description: Calling restore_error_handler inside destructor crashes PHP
Description:
------------
This may be related to an older bug that was fixed (#24708) but I can
reproduce reliably (having spent days and hours chasing!). Basically, if
you call restore_error_handler from __destruct() things go horribly ary.
Interestingly enough, calling restore_exception_handler works just fine.
This happens both CLI and Apache 2.x.
Note that it does not matter if you use $this or &$this in the
constructor.
Reproduce code:
---------------
function __construct(
&$aConfig
)
{
if(is_array($aConfig))
{
$this->m_aConfig = &$aConfig; // Extraneous but it's in my
constructor.
set_error_handler(array &$this, "handleRuntimeException"));
set_exception_handler(array($this, "handleException"));
}
}
function __destruct()
{
//restore_error_handler();
restore_exception_handler();
unset($this->m_aConfig);
}
Expected result:
----------------
Proper ending of PHP script execution.
Actual result:
--------------
Segfault in php5ts.dll, ModVer: 5.0.3.3 Offset: 0004d661
--
Edit bug report at http://bugs.php.net/?id=31894&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31894&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31894&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31894&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31894&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31894&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31894&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31894&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31894&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31894&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31894&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31894&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31894&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31894&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31894&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31894&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31894&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31894&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31894&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31894&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31894&r=mysqlcfg