cvs: pearweb /include pear-format-html.php
| From: | Christian Weiske | Date: | Thu, 02 Apr 2009 20:23:44 +0000 |
| Subject: | cvs: pearweb /include pear-format-html.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-8297@lists.php.net to get a copy of this message | ||
cweiske Thu Apr 2 20:23:44 2009 UTC
Modified files:
/pearweb/include pear-format-html.php
Log:
put errors in the system's error log
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-format-html.php?r1=1.278&r2=1.279&diff_format=u
Index: pearweb/include/pear-format-html.php
diff -u pearweb/include/pear-format-html.php:1.278 pearweb/include/pear-format-html.php:1.279
--- pearweb/include/pear-format-html.php:1.278 Fri Mar 13 14:11:04 2009
+++ pearweb/include/pear-format-html.php Thu Apr 2 20:23:44 2009
@@ -15,7 +15,7 @@
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
- $Id: pear-format-html.php,v 1.278 2009/03/13 14:11:04 saltybeagle Exp $
+ $Id: pear-format-html.php,v 1.279 2009/04/02 20:23:44 cweiske Exp $
*/
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler');
@@ -468,6 +468,23 @@
}
/**
+ * Returns the detailled error message of an PEAR_Error or an Exception
+ *
+ * @param PEAR_Error|Exception $error Error object
+ *
+ * @return string Detailled error message
+ */
+function get_detail_error_msg($error)
+{
+ if ($error instanceof Exception) {
+ $msg = $error->__toString();
+ } else {
+ $msg = $error->getMessage() . '... ' . $error->getUserInfo();
+ }
+ return $msg;
+}
+
+/**
* Display errors or warnings as a <ul> inside a <div>
*
* Here's what happens depending on $in:
@@ -489,11 +506,7 @@
{
if (PEAR::isError($in) || $in instanceof Exception) {
if (DEVBOX == true) {
- if ($in instanceof Exception) {
- $in = array($in->__toString());
- } else {
- $in = array($in->getMessage() . '... ' . $in->getUserInfo());
- }
+ $in = array(get_detail_error_msg($in));
} else {
$in = array($in->getMessage());
}
@@ -507,11 +520,7 @@
foreach ($in as $msg) {
if (PEAR::isError($msg) || $msg instanceof Exception) {
if (DEVBOX == true) {
- if ($msg instanceof Exception) {
- $msg = array($msg->__toString());
- } else {
- $msg = array($msg->getMessage() . '... ' .
$msg->getUserInfo());
- }
+ $msg = get_detail_error_msg($msg);
} else {
$msg = $msg->getMessage();
}
@@ -558,6 +567,7 @@
response_header($title);
report_error($errobj);
response_footer();
+ error_log('pearweb errorhandler: ' . get_detail_error_msg($errobj), 0);
exit;
}