Skip to content

Commit

Permalink
* add custom error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
stigsb committed Jun 2, 2002
1 parent 9a90658 commit d0abd6e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pear/scripts/pear.in
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d0abd6e

Please sign in to comment.