#24216 [Opn->Bgs]: set_error_handler without effect in some situations
| From: | derick@php.net | Date: | Tue, 17 Jun 2003 07:14:48 +0000 |
| Subject: | #24216 [Opn->Bgs]: set_error_handler without effect in some situations | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-42102@lists.php.net to get a copy of this message | ||
ID: 24216
Updated by: derick@php.net
Reported By: redeye at erisx dot de
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux / Windows
PHP Version: 4.3.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is expected behavior, otherwise PHP will end up in a never-ending
loop calling the error handler from the error handler...
Previous Comments:
------------------------------------------------------------------------
[2003-06-17 01:24:50] redeye at erisx dot de
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 this bug report at http://bugs.php.net/?id=24216&edit=1