ID:               34329
 User updated by:  marcos dot neves at gmail dot com
 Reported By:      marcos dot neves at gmail dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Unknown/Other Function
 Operating System: *
 PHP Version:      5.1.0RC1
 New Comment:

Sorry, I did more tests and it's still no right.
The documentation says: "Calling restore_error_handler() from the
error_handler function is ignored."
This is bugged for 5.0.4 and is not true for 5.1.0RC1

The follow code works as I expect in 5.1.0RC1 on windows.
But on 5.0.4 restore_error_handler is ignored inside error_handler, but
calling restore_error_handler outside, will exec twice, as if the
restore_error_handler was pushed on a stack.

<pre>
<?

function error_handler1() {
        echo "\n[".__FUNCTION__."]\n";
}

function error_handler2() {
        echo "\n[".__FUNCTION__."]\n";
}

function error_handler3() {
        echo "\n[".__FUNCTION__."]\n";
//      restore_error_handler();
}

function error_handler4() {
        echo "\n[".__FUNCTION__."]\n";
        restore_error_handler();
}

set_error_handler('error_handler1');
set_error_handler('error_handler2');
set_error_handler('error_handler3');
set_error_handler('error_handler4');

echo foo;
echo bar;

restore_error_handler();

echo test;

?>

RESULT FOR 5.0.4
[error_handler4]
foo
[error_handler4]
bar
[error_handler1]
test

if the restore_error_handler is really ignored inside error handler,
the result should be:
[error_handler4]
foo
[error_handler4]
bar
[error_handler3]
test

RESULT FOR 5.1.0RC1
[error_handler4]
foo
[error_handler3]
bar
[error_handler1]
test

it seens that restore_error_handler is not ignored inside handler on
5.1.0RC1


Previous Comments:
------------------------------------------------------------------------

[2005-09-01 16:18:20] [EMAIL PROTECTED]

Maybe you should read how the "bug" was resolved? It wasn't really bug
in PHP itself but just missing documentation.


------------------------------------------------------------------------

[2005-09-01 16:06:40] marcos dot neves at gmail dot com

Description:
------------
The bug #31675 is closed and says its fixed,
but the problem persist in 5.04 and 5.1.

Reproduce code:
---------------
<?
function error_handler1() {
        echo "[".__FUNCTION__."]";
}

function error_handler2() {
        echo "[".__FUNCTION__."]";
        restore_error_handler();// does not restore
}

set_error_handler('error_handler1');
set_error_handler('error_handler2');

echo foo;
?>

Expected result:
----------------
[error_handler1]foo

Actual result:
--------------
[error_handler2]foo


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34329&edit=1

Reply via email to