From:             [EMAIL PROTECTED]
Operating system: Any
PHP version:      5CVS-2005-11-04 (CVS)
PHP Bug Type:     Scripting Engine problem
Bug description:  A custom handler set with set_error_handler() cannot be 
unset/removed

Description:
------------
A custom error handler set with set_error_handler() cannot be removed.

The documentation says that the return value of set_error_handler() is the
previous error handler. In case of no previous error handler, NULL is
returned.

However set_error_handler() cannot be called with NULL to restore the PHP
default error handler. This results in the following:

$ php -r 'set_error_handler(NULL);'
Warning: set_error_handler() expects argument 1, '', to be a valid
callback in Command line code on line 1


Reproduce code:
---------------
<?php
    function handler() {
        echo "called\n";
    }

    set_error_handler('handler called');
    set_error_handler();
?>


Expected result:
----------------
Somehow a way for removing the current error handler and restoring the
original behaviour should be possible.

Actual result:
--------------
handler called

-- 
Edit bug report at http://bugs.php.net/?id=35101&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35101&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=35101&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=35101&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=35101&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=35101&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=35101&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=35101&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=35101&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=35101&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=35101&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=35101&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=35101&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=35101&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35101&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=35101&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=35101&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=35101&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35101&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=35101&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35101&r=mysqlcfg

Reply via email to