#41418 [Bgs->Opn]: Mechanism for trapping fatal errors
| From: | public at syranide dot com | Date: | Thu, 17 May 2007 17:34:53 +0000 |
| Subject: | #41418 [Bgs->Opn]: Mechanism for trapping fatal errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112763@lists.php.net to get a copy of this message | ||
ID: 41418
User updated by: public at syranide dot com
Reported By: public at syranide dot com
-Status: Bogus
+Status: Open
Bug Type: Feature/Change Request
PHP Version: 5.2.2
New Comment:
That isn't quite what I meant, as clients will still see a php error,
or none at all and you have no means of invoking your own routines.
Being able to output a custom error message or even try to recover from
it, log the error using custom utilities and even send a warning by mail
would be a major addition to PHP in my opinion for larger systems.
If you feel that this is not a relevant feature then return it to
"bogus".
Previous Comments:
------------------------------------------------------------------------
[2007-05-17 17:21:23] tony2001@php.net
log_errors = On
error_log = <whatever you want>
------------------------------------------------------------------------
[2007-05-17 17:05:30] public at syranide dot com
Description:
------------
Something I've been longing to see is a way to catch fatal errors so
that PHP doesn't print out errors to the clients or worse, nothing at
all. Obviously this isn't possible as the engine might be in an unstable
state and it would be unsafe to continue.
But I figure if the internals of PHP can handle it, would it not be
possible to upon fatal errors run a pre-defined script filename
(settable via iniset/putenv as well) using a new instance of the engine
with the error available (perhaps the backtrace as well) in $_SERVER or
wherever? So that you could apply your own error logging and output.
So instead of:
runscript IF fatalerror THEN printfatal END
You would get something like:
runscript IF fatalerror THEN runhandler IF fatalerror THEN printfatal
END END
This would be a blessing for both custom debugging functionality,
giving clients useful errors and being able to log these actions using
custom utilities (most people don't have access or log php errors in the
http-log). As in fact, the common fatal errors are that you have called
a non-existant function, worked on a bad object or put in a bad
character and not the engine going rogue.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41418&edit=1