summaryrefslogtreecommitdiff
path: root/pear/scripts
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-06-02 13:07:19 +0000
committerStig Bakken <ssb@php.net>2002-06-02 13:07:19 +0000
commitf111dff665fb5501065a67928d1b79e9ad8e89a8 (patch)
tree43bfb294046c37fdd3aff537f7a2a9f119667322 /pear/scripts
parentb341789bb86a2b3b5acea3253a15ab4efdaf04e2 (diff)
downloadphp-git-f111dff665fb5501065a67928d1b79e9ad8e89a8.tar.gz
* merge NEW_UI_API branch
Diffstat (limited to 'pear/scripts')
-rw-r--r--pear/scripts/pear.in31
1 files changed, 28 insertions, 3 deletions
diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in
index c8a2ed333e..d7d77a3e23 100644
--- a/pear/scripts/pear.in
+++ b/pear/scripts/pear.in
@@ -30,6 +30,10 @@ 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');
+
+$pear_package_version = "@pear_version@";
require_once 'PEAR.php';
require_once 'PEAR/Config.php';
@@ -225,7 +229,6 @@ function cmdHelp($command)
" -u foo unset `foo' in the user configuration\n".
" -h, -? display help/usage (this message)\n".
" -V version information\n";
-
} elseif ($command == "shortcuts") {
$sc = PEAR_Command::getShortcuts();
$ret = "Shortcuts:\n";
@@ -235,8 +238,7 @@ function cmdHelp($command)
return $ret;
} elseif ($command == "version") {
- $reg = &new PEAR_Registry($config->get('php_dir'));
- return "PEAR " . $reg->packageInfo('PEAR', 'version');
+ return "PEAR $GLOBALS[pear_package_version]";
} elseif ($help = PEAR_Command::getHelp($command)) {
if (is_string($help)) {
@@ -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