cvs: php4(NEW_UI_API) /pear/scripts pear.in

From: Date: Sun, 02 Jun 2002 07:49:56 +0000
Subject: cvs: php4(NEW_UI_API) /pear/scripts pear.in
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4355@lists.php.net to get a copy of this message
ssb Sun Jun 2 03:49:56 2002 EDT Modified files: (Branch: NEW_UI_API) /php4/pear/scripts pear.in Log: * add custom error handler Index: php4/pear/scripts/pear.in diff -u php4/pear/scripts/pear.in:1.56 php4/pear/scripts/pear.in:1.56.2.1 --- php4/pear/scripts/pear.in:1.56 Mon May 27 20:45:19 2002 +++ php4/pear/scripts/pear.in Sun Jun 2 03:49:56 2002 @@ -19,7 +19,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: pear.in,v 1.56 2002/05/28 00:45:19 ssb Exp $ +// $Id: pear.in,v 1.56.2.1 2002/06/02 07:49:56 ssb Exp $ /** * @nodep Gtk @@ -30,6 +30,8 @@ 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'; @@ -248,6 +250,29 @@ } // }}} + +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:

« previous php.pear.cvs (#4355) next »