|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-11-04 09:13 UTC] mfischer@php.net
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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 23:00:01 2025 UTC |
well restore_error_handler() works in 5.1.1.. so what happened? code: <? function foo() { echo 'foo'; } set_error_handler('foo'); z; restore_error_handler(); f; ?> output: jon@ac-dev-sv1 ~ $ php -f foo.php foo Notice: Use of undefined constant f - assumed 'f' in /home/jon/foo.php on line 7