#35626 [Opn->Bgs]: throwing an exception in error handler is makeing it display a warning
ID: 35626
Updated by: tony2001@php.net
Reported By: elg at op dot pl
-Status: Open
+Status: Bogus
Bug Type: Compile Warning
Operating System: windows
PHP Version: 5.1.1
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
You're using exception handler that apparently makes exceptions to
disappear.
Previous Comments:
------------------------------------------------------------------------
[2005-12-10 22:49:03] elg at op dot pl
Description:
------------
I wanted to convert errors to exceptions by writing an error handler
that throws them as exceptions.
Then I wanted to check if it works so I tried to include a non
existing file (info.txt)
Reproduce code:
---------------
<?php
function exceptionHandler($exc){
echo ':)';
}
function ErrorsToExceptions($severity, $message) {
throw new ErrorException($message,0, $severity);
}
set_exception_handler('exceptionHandler');
set_error_handler('ErrorsToExceptions');
include'dupa.txt';
?>
Expected result:
----------------
:)
Actual result:
--------------
Warning: main() [function.include]: Failed opening 'info.txt' for
inclusion (include_path='.;C:\php5\pear') in
E:\usr\\www\index.php on line 8
:)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35626&edit=1
Thread (3 messages)