From:             redeye at erisx dot de
Operating system: Linux / Windows
PHP version:      4.3.2
PHP Bug Type:     Scripting Engine problem
Bug description:  set_error_handler without effect in some situations

Description:
------------
It seams like PHP doesn't keep the error_handler when a function is called
which contains another trigger_error. This can lead to a quite unwanted
behaviour on scripts that require an own error_handler.

Reproduce code:
---------------
<?php

function
my_error_handler($error_number,$error_message,$error_filename,$error_line){
    echo 'Using my_error_handler: '.$error_message.'<br>';

    if ( $error_number == E_USER_NOTICE ){
        call_error();
    }
}
function call_error(){
    trigger_error('From call_error()', E_USER_WARNING);
}

set_error_handler('my_error_handler');

trigger_error('test', E_USER_NOTICE);
trigger_error('another test', E_USER_NOTICE);

?>

Expected result:
----------------
Using my_error_handler: test
Using my_error_handler: From call_error()
Using my_error_handler: another test
Using my_error_handler: From call_error()

Actual result:
--------------
Using my_error_handler: test
Warning: From call_error() in /www/test.php on line 11
Using my_error_handler: another test
Warning: From call_error() in /www/test.php on line 11


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

Reply via email to