From:             auroraeosrose at hotmail dot com
Operating system: Windows XP Pro SP1
PHP version:      5CVS-2003-07-18 (dev)
PHP Bug Type:     Reproducible crash
Bug description:  Calling restore_error_handler() in a destructor crashes things 

Description:
------------
Latest php snap of 5.0
Apache 2 filter
mb_string, gd, mssql, and mysql only dll's loaded

Error handler class - constructor calls set_error_handler and works just
fine, descructor calls restore_error_handler and the server crashes nicely
- not only the phpdll but all of apache as well in a second message.  I
have some dump files if you need them, just leave a message.

Reproduce code:
---------------
<?php
class Error
{
        function __construct()
        {
                set_error_handler(array(&$this, 'handler'));
        }

        function __destruct()
        {
                restore_error_handler();
        }

        function handler($no, $str, $file, $line, $ctx)
        {
                echo '<pre>';
                echo 'no   : ' . $no . "\n";
                echo 'str  : ' . $str . "\n";
                echo 'file : ' . $file . "\n";
                echo 'line : ' . $line . "\n";
                echo 'ctx  : ';
                print_r($ctx);
                echo '</pre>';
        }

}

$error = new error();
echo $dog;

?> 

Expected result:
----------------
no   : 8
str  : Undefined variable:  dog
file : ****/test.php
line : 29
ctx  : Array
(
    [GLOBALS] => Array
 *RECURSION*
    [_POST] => Array
        (
        )

    [_GET] => Array
        (
        )

    [_COOKIE] => Array
        (
        )

    [_FILES] => Array
        (
        )

    [error] => error Object
        (
        )

)

Actual result:
--------------
Comment out the restore_error_handler and it works jim dandy

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

Reply via email to