note 26019 added to function.set-error-handler
| From: | goran_johansson at yahoo dot IDONTLIKESPAM dot com | Date: | Tue, 15 Oct 2002 12:19:55 +0000 |
| Subject: | note 26019 added to function.set-error-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38104@lists.php.net to get a copy of this message | ||
A dirty but fully working way of capturing EVERY ERROR(even fatal, parse etc.) in PHP is the
following little code-snippet:
Use this in a separate file eg. error_handler.php
ini_set('error_prepend_string', '<body onload="r.submit()"><form
action="error.php" name="r"><textarea name="e"
STYLE="visibility: hidden">');
ini_set('error_append_string', '</textarea></form></body>');
Then create a page called error.php and the error message is sent in the variable "e". I
that page you can show a friendly error-message, write to any log, send a mail or whatever you like.
This works perfectly for me, and should work for any user that has a browser accepting javascript.
--
http://www.php.net/manual/en/function.set-error-handler.php
http://master.php.net/manage/user-notes.php?action=edit+26019
http://master.php.net/manage/user-notes.php?action=delete+26019
http://master.php.net/manage/user-notes.php?action=reject+26019