#50446 [Opn->Ver]: Missing documentation for SET_EXCEPTION_HANDLER()
| From: | bjori@php.net | Date: | Fri, 11 Dec 2009 20:10:46 +0000 |
| Subject: | #50446 [Opn->Ver]: Missing documentation for SET_EXCEPTION_HANDLER() | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3449@lists.php.net to get a copy of this message | ||
ID: 50446
Updated by: bjori@php.net
-Summary: Missing documentation or bug for
SET_EXCEPTION_HANDLER()
Reported By: randallgirard at hotmail dot com
-Status: Open
+Status: Verified
Bug Type: Documentation problem
Operating System: Windows
PHP Version: 5.3.1
New Comment:
replace that "*must*" with an RCC2119 SHOULD
Previous Comments:
------------------------------------------------------------------------
[2009-12-11 20:08:09] bjori@php.net
To process *unhandled* exceptions.
If your application throws an exception you don't expect, then you
*must* have an exception handler that catches that exception, logs it,
and prints a pretty error page for your user.
Maybe we should add a tip or a better usecase/description? (re-opening)
------------------------------------------------------------------------
[2009-12-11 19:41:00] randallgirard at hotmail dot com
What is the reason for this functionality, if you cannot return to
processing of the script?
------------------------------------------------------------------------
[2009-12-11 09:55:54] rquadling@php.net
As does the Description ...
"Execution will stop after the exception_handler is called."
Nothing additional required.
------------------------------------------------------------------------
[2009-12-11 09:34:47] rquadling@php.net
The example does show this, but some additional words may be useful.
------------------------------------------------------------------------
[2009-12-11 02:44:48] randallgirard at hotmail dot com
Description:
------------
The documentation does not state for the function
set_exception_handler(...) that it will terminate processing. I do not
see much of a reason for such a handler if you do not have this option.
Unless I am missing something, please include such documentation or fix
this in the next release. Take for example set_error_handler() which
forces you to handle termination of the script (when necessary) from
code.
NOTE: I am using v5.3.0 on my local machine for testing, and havent
tested on my server which runs 5.3.1 but I doubt this is the case.
Reproduce code:
---------------
function exception_handler($exception) {
echo "Uncaught exception: " , $exception->getMessage(), "\n";
}
set_exception_handler('exception_handler');
function errorone() {
throw new Exception("Test 1");
}
function errortwo() {
throw new Exception("Test 2");
}
function test() {
errorone();
errortwo();
}
test();
test();
# I also did further tests involving class scopes that I thought might
affect this, but I'm almost positive processing of the script is
terminated without a way to restore it.
Expected result:
----------------
Uncaught exception: Test 1\nUncaught exception: Test 2\nUncaught
exception: Test 1\nUncaught exception: Test 2\n
Actual result:
--------------
Uncaught exception: Test 1\n
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50446&edit=1