php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35626 throwing an exception in error handler is makeing it display a warning
Submitted: 2005-12-10 22:49 UTC Modified: 2005-12-11 13:52 UTC
From: elg at op dot pl Assigned:
Status: Not a bug Package: Compile Warning
PHP Version: 5.1.1 OS: windows
Private report: No CVE-ID: None
 [2005-12-10 22:49 UTC] 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
:)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-10 22:59 UTC] tony2001@php.net
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. 
 [2005-12-11 13:52 UTC] elg at op dot pl
If I've miss undersend your sugestion then I'm truelly sory but I know that my exceptions handler makes nothing with cought exception and I dont think this is the problem. Even if there would be no exception handler or if it would write this exception information into a file it should not display this worning (in fact it is not showing any warnings when I am not throwing exceptions in error handler). Sory for taking your time with this problem but I have searched many forums for help and there was nobody that could help me :(
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC