/** * Init * * reset error/exception handler and atach panda handler * * @param array $config config * * @return void */ public static function init(array $config = array()) { if (isset($_GET['_nopanda'])) { return; } $er = error_reporting(false); self::$_config = array_merge(self::$_config, $config); // reset handler if (self::$_config[self::CONFIG_DEBUG] !== true) { ini_set('display_errors', 0); function p($v = '') { syslog(LOG_INFO, print_r($v, true)); } if (class_exists('PEAR', false)) { PEAR::setErrorHandling(PEAR_Exception); } set_exception_handler(array('Panda', 'onException')); } else { if (self::$_config[self::CONFIG_ENABLE_FIREPHP]) { include_once 'FirePHPCore/FirePHP.class.php'; include_once 'FirePHPCore/fb.php'; } self::_initOnDebug(); if (self::$_config[self::CONFIG_CATCH_FATAL] === true) { ob_start(array('Panda', 'onFatalError')); } // catch E_STRICT if (self::$_config[self::CONFIG_CATCH_STRICT] === true) { error_reporting(E_ALL | E_STRICT); ob_start(array('Panda', 'onStrictError')); } } error_reporting($er); }