summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-06-02 07:49:56 +0000
committerStig Bakken <ssb@php.net>2002-06-02 07:49:56 +0000
commitd0abd6e5ae523f29433b8a00c30c56084cc55389 (patch)
tree924dcfbcdfe443353a9e928a9f19e0bbcb04f431
parent9a90658bd08ec5fa1321260401f6e5842e6334c0 (diff)
downloadphp-git-d0abd6e5ae523f29433b8a00c30c56084cc55389.tar.gz
* add custom error handler
-rw-r--r--pear/scripts/pear.in25
1 files changed, 25 insertions, 0 deletions
diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in
index c8a2ed333e..43d49d739b 100644
--- a/pear/scripts/pear.in
+++ b/pear/scripts/pear.in
@@ -30,6 +30,8 @@ ob_implicit_flush(true);
ini_set('track_errors', true);
ini_set('html_errors', false);
ini_set('magic_quotes_runtime', false);
+error_reporting(E_ALL & ~E_NOTICE);
+set_error_handler('error_handler');
require_once 'PEAR.php';
require_once 'PEAR/Config.php';
@@ -249,6 +251,29 @@ function cmdHelp($command)
// }}}
+function error_handler($errno, $errmsg, $file, $line, $vars) {
+ if (error_reporting() == 0) {
+ return; // @silenced error
+ }
+ $errortype = array (
+ 1 => "Error",
+ 2 => "Warning",
+ 4 => "Parsing Error",
+ 8 => "Notice",
+ 16 => "Core Error",
+ 32 => "Core Warning",
+ 64 => "Compile Error",
+ 128 => "Compile Warning",
+ 256 => "User Error",
+ 512 => "User Warning",
+ 1024=> "User Notice"
+ );
+ $prefix = $errortype[$errno];
+ $file = basename($file);
+ print "\n$prefix: $errmsg in $file on line $line\n";
+}
+
+
/*
* Local variables:
* tab-width: 4