ID: 35101
Comment by: jon at fuck dot org
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 6CVS
New Comment:
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:
[EMAIL PROTECTED] ~ $ php -f foo.php
foo
Notice: Use of undefined constant f - assumed 'f' in /home/jon/foo.php
on line 7
Previous Comments:
------------------------------------------------------------------------
[2005-11-04 09:16:35] [EMAIL PROTECTED]
Nowhere it says that this is possible, thus marking it as a Feature
Request.
------------------------------------------------------------------------
[2005-11-04 09:13:35] [EMAIL PROTECTED]
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 this bug report at http://bugs.php.net/?id=35101&edit=1