• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ErrorHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ErrorHandler的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler类的具体用法?PHP ErrorHandler怎么用?PHP ErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ErrorHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: error_handling_live

 public static function error_handling_live($err_no, $err_str, $err_file, $err_line, $err_context)
 {
     $exception = new ErrorException($err_str, 0, $err_no, $err_file, $err_line);
     $ErrorHandler = new ErrorHandler($exception);
     $ErrorHandler->ProcessError();
     return;
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:7,代码来源:Debugger.class.inc.php


示例2: registerWith

 /** Registers this with an ErrorHandler.  Will register as a late-binding
     handler, so other error handlers take precedence. */
 static function registerWith(ErrorHandler $eh, $includeWarnings = self::NoWarnings)
 {
     self::$fullMap = self::$fullMap ?: self::$errorMap + self::$warningMap;
     $errors = self::getBits(self::$errorMap);
     if ($includeWarnings) {
         $errors |= self::getBits(self::$warningMap);
     }
     $eh->addErrorHandler($errors, "/^(.*)\$/", [__CLASS__, 'handleError'], ErrorHandler::Late);
 }
开发者ID:bettrlife,项目名称:elephander,代码行数:11,代码来源:Exceptionizer.php


示例3: register

 /**
  * register handler
  * $errorLevel determines level at which an Exception is thrown (NULL forces error_reporting() return value, 0 to disable error reporting)
  * 
  * @param integer $errorLevel
  * @param boolean $displayErrors
  * 
  * @throws \RuntimeException
  * @return \vxPHP\Debug\ErrorHandler
  */
 public static function register($errorLevel = NULL, $displayErrors = TRUE)
 {
     if (self::$handler) {
         throw new \RuntimeException('Error handler already registered.');
     }
     self::$handler = new static();
     self::$handler->setLevel($errorLevel)->setDisplayErrors($displayErrors);
     // disable "native" error display mechanism
     ini_set('display_errors', 0);
     // set handler
     set_error_handler(array(self::$handler, 'handle'));
     return self::$handler;
 }
开发者ID:vectrex,项目名称:vxphp,代码行数:23,代码来源:ErrorHandler.php


示例4: testShouldDisplay404Error

 /**
  * Tests
  */
 public function testShouldDisplay404Error()
 {
     $request = new NeechyRequest();
     $page = Page::find_by_title('NeechyPage');
     try {
         throw new NeechyWebServiceError('Testing 404 Error', 404);
     } catch (NeechyError $e) {
         $handler = new ErrorHandler($request);
         $response = $handler->handle_error($e);
     }
     $this->assertEquals(404, $response->status);
     $this->assertContains($e->getMessage(), $response->body);
     $this->assertContains('Testing 404 Error', $response->body);
 }
开发者ID:klenwell,项目名称:neechy-app-engine,代码行数:17,代码来源:ErrorHandlerTest.php


示例5: shutdownCheck

 public static function shutdownCheck()
 {
     //error_log("shutdown check");
     if ($error = error_get_last()) {
         if ($error['type'] == E_COMPILE_ERROR) {
             $exception = new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
             if (strpos($exception->getMessage(), "Cannot redeclare class") !== false) {
                 //send email alerts for duplicate class declarations.. error already logged by php
                 $ErrorHandler = new ErrorHandler($exception);
                 $ErrorHandler->email_alert();
             }
         }
     }
     return;
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:15,代码来源:ErrorHandler.class.inc.php


示例6: enable

 /**
  * Enables the debug tools.
  *
  * This method registers an error handler and an exception handler.
  *
  * If the Symfony ClassLoader component is available, a special
  * class loader is also registered.
  *
  * @param int  $errorReportingLevel The level of error reporting you want
  * @param bool $displayErrors       Whether to display errors (for development) or just log them (for production)
  */
 public static function enable($errorReportingLevel = E_ALL, $displayErrors = true)
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     if (null !== $errorReportingLevel) {
         error_reporting($errorReportingLevel);
     } else {
         error_reporting(E_ALL);
     }
     if ('cli' !== PHP_SAPI) {
         ini_set('display_errors', 0);
         ExceptionHandler::register();
     } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
         // CLI - display errors only if they're not already logged to STDERR
         ini_set('display_errors', 1);
     }
     if ($displayErrors) {
         ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
     } else {
         ErrorHandler::register()->throwAt(0, true);
     }
     DebugClassLoader::enable();
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:36,代码来源:Debug.php


示例7: get_domains_of_admin

 /**
  *  return array of domain ids which can administer given user
  *
  *
  *  Possible options:
  *	 - none
  *      
  *	@param string $uid		
  *	@param array $opt		associative array of options
  *	@return array			array of domain ids or FALSE on error
  */
 function get_domains_of_admin($uid, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $t_name =& $config->data_sql->domain_attrs->table_name;
     /* col names */
     $c =& $config->data_sql->domain_attrs->cols;
     /* flags */
     $f =& $config->data_sql->domain_attrs->flag_values;
     $an =& $config->attr_names;
     $q = "select " . $c->did . " \n\t\t    from " . $t_name . "\n\t\t\twhere  " . $c->name . "  = '" . $an['admin'] . "' and \n\t\t\t       " . $c->value . " = " . $this->sql_format($uid, "s") . " and \n\t\t\t      (" . $c->flags . " & " . $f['DB_DELETED'] . ") = 0 and\n\t\t\t\t  (" . $c->flags . " & " . $f['DB_FOR_SERWEB'] . ") = " . $f['DB_FOR_SERWEB'];
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = array();
     for ($i = 0; $row = $res->fetchRow(DB_FETCHMODE_ASSOC); $i++) {
         $out[$i] = $row[$c->did];
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:39,代码来源:method.get_domains_of_admin.php


示例8: dispatch

 public function dispatch()
 {
     $helper = HelperFactory::getHelper("Http");
     $conf = $helper->parseGet($_GET);
     try {
         $staticRoute = $this->getCotrollerByAlias(ucfirst($conf["controller"]));
         if ($staticRoute !== false) {
             $conf["controller"] = $staticRoute['controller'];
             if ($staticRoute['action'] != '') {
                 $conf["action"] = $staticRoute['action'];
             }
         }
         $controller = ControllerFactory::getController(ucfirst($conf["controller"]));
         $controller->applyFilters($conf);
         $action = $conf["action"] . "Action";
         $controller->startUp($conf);
         call_user_func_array(array($controller, $action), $conf["param"]);
         $controller->render($conf["action"]);
     } catch (Doctrine_Connection_Exception $e) {
         exit($e->getMessage());
         ErrorHandler::displayError("Found a Doctrine connection error.<br>\n\t\t\t\t\t\t\t\t\t \tMake suere that you have started the Doctrine\n\t\t\t\t\t\t\t\t\t \tsubsystem.<br>");
     } catch (MissingControllerException $e) {
         exit("<h1>ERROR</h1><br><h2>Missing Controller</h2>");
     } catch (MissingClassException $e) {
         exit("<h1>ERROR</h1><br><h2>Missing class</h2>");
     } catch (Exception $e) {
         exit($e->getMessage());
         $controller = ControllerFactory::getController("_404");
         $controller->startUp();
         $controller->render("index");
     }
 }
开发者ID:p1r0,项目名称:MuffinPHP,代码行数:32,代码来源:DefaultDispatcher.php


示例9: CheckErrors

 private static function CheckErrors()
 {
     if (!ErrorHandler::IsEmpty()) {
         ErrorHandler::Show();
         die;
     }
 }
开发者ID:clashbyte,项目名称:mee,代码行数:7,代码来源:App.php


示例10: verify

 /**
  * Verifies a recaptcha
  *
  * @param $priv_key private recaptcha key
  * @return true on success
  */
 public function verify()
 {
     $error = ErrorHandler::getInstance();
     $conf = RecaptchaConfig::getInstance();
     if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
         $error->add('No captcha answer given.');
         return false;
     }
     if (!$conf->getPublicKey() || !$conf->getPrivateKey()) {
         die('ERROR - Get Recaptcha API key at http://recaptcha.net/api/getkey');
     }
     $params = array('privatekey' => $conf->getPrivateKey(), 'remoteip' => client_ip(), 'challenge' => $_POST['recaptcha_challenge_field'], 'response' => $_POST['recaptcha_response_field']);
     $http = new HttpClient($this->api_url_verify);
     $res = $http->post($params);
     $answers = explode("\n", $res);
     if (trim($answers[0]) == 'true') {
         return true;
     }
     switch ($answers[1]) {
         case 'incorrect-captcha-sol':
             $e = 'Incorrect captcha solution';
             break;
         default:
             $e = 'untranslated error: ' . $answers[1];
     }
     $error->add($e);
     return false;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:34,代码来源:Recaptcha.php


示例11: install

 public static function install()
 {
     if (isset(self::$prev)) {
         throw new Exception('ErrorHandler: Alread Installed');
     }
     self::$prev = set_error_handler(array(__CLASS__, 'handler'));
 }
开发者ID:vbarbarosh,项目名称:php_tailf_sse,代码行数:7,代码来源:error.php


示例12: delete_user_attrs

 /**
  *	delete all user's records from user_attrs
  */
 function delete_user_attrs($uid)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $t_name =& $config->data_sql->user_attrs->table_name;
     /* col names */
     $c =& $config->data_sql->user_attrs->cols;
     /* flags */
     $f =& $config->data_sql->user_attrs->flag_values;
     $q = "delete from " . $t_name . " \n\t\t      where " . $c->uid . "  = '" . $uid . "'";
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         if ($res->getCode() == DB_ERROR_NOSUCHTABLE) {
             return true;
         } else {
             ErrorHandler::log_errors($res);
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.delete_user_attrs.php


示例13: delete_acc

 /**
  *  Purge old acc records
  *
  *  Possible options parameters:
  *		none
  *
  *	@param array $opt		associative array of options
  *	@return bool			TRUE on success, FALSE on failure
  */
 function delete_acc($opt)
 {
     global $config;
     if (!$config->keep_acc_interval) {
         return true;
     }
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return 0;
     }
     /* table's name */
     $t_name =& $config->data_sql->acc->table_name;
     /* col names */
     $c =& $config->data_sql->acc->cols;
     /* flags */
     $f =& $config->data_sql->acc->flag_values;
     if ($this->db_host['parsed']['phptype'] == 'mysql') {
         $q = "delete from " . $t_name . " \n\t\t\t\twhere DATE_ADD(" . $c->request_timestamp . ", INTERVAL " . $config->keep_acc_interval . " DAY) < now()";
     } else {
         $q = "delete from " . $t_name . " \n\t\t\t\twhere (" . $c->request_timestamp . " + INTERVAL '" . $config->keep_acc_interval . " DAY') < now()";
     }
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         //expect that table mayn't exist in installed version
         if ($res->getCode() != DB_ERROR_NOSUCHTABLE) {
             ErrorHandler::log_errors($res);
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:41,代码来源:method.delete_acc.php


示例14: debug

 public static function debug($message)
 {
     if (!DEBUG) {
         return;
     }
     ErrorHandler::error(500, "Debug", "<pre>" . $message . "</pre>", 3);
 }
开发者ID:davbfr,项目名称:cf,代码行数:7,代码来源:Output.class.php


示例15: get_credentials

 /**
  *  return array of credentials of user
  *
  *  Possible options:
  *	 - none
  *    	
  *	@param	string	$uid	uid of user
  *	@param	array	$opt	array of options
  *	@return array			array of credentials
  */
 function get_credentials($uid, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $t_name =& $config->data_sql->credentials->table_name;
     /* col names */
     $c =& $config->data_sql->credentials->cols;
     /* flags */
     $f =& $config->data_sql->credentials->flag_values;
     $q = "select " . $c->did . ", \n\t\t           " . $c->uname . ",\n\t\t           " . $c->realm . ",\n\t\t           " . $c->password . ",\n\t\t           " . $c->ha1 . ",\n\t\t           " . $c->ha1b . ",\n\t\t           " . $c->flags . "\n\t\t    from " . $t_name . " \n\t\t\twhere " . $c->uid . " = " . $this->sql_format($uid, "s") . " and\n\t\t\t      " . $c->flags . " & " . $f['DB_DELETED'] . " = 0\n\t\t\torder by " . $c->realm . ", " . $c->uname;
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = array();
     for ($i = 0; $row = $res->fetchRow(DB_FETCHMODE_ASSOC); $i++) {
         $out[$i] = new Credential($uid, $row[$c->did], $row[$c->uname], $row[$c->realm], $row[$c->password], $row[$c->ha1], $row[$c->ha1b], $row[$c->flags]);
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:37,代码来源:method.get_credentials.php


示例16: actionPermissionDenied

 /**
  * Show Permission denied page
  */
 public function actionPermissionDenied()
 {
     // TODO: logout user, redirect to admin login form and the error should be dislayed in the form
     ErrorHandler::logError('Permission denied!<br />- You do not have enough privilege to access the page you requested or<br />- The requested page is accessible but a service on that page cannot be performed on your behalf.');
     Yii::app()->layout = 'permission';
     $this->render('PermissionDenied');
 }
开发者ID:hung5s,项目名称:yap,代码行数:10,代码来源:BackOfficeController.php


示例17: getDecodeJson

 public function getDecodeJson($key, $default = null)
 {
     ErrorHandler::start();
     $params = json_decode($this->getParam($key), $default);
     ErrorHandler::stop();
     return (array) $params;
 }
开发者ID:orbisnull,项目名称:orbistools,代码行数:7,代码来源:Request.php


示例18: del_credentials

 /**
  *  Delete credentials from DB
  *
  *	On error this method returning FALSE.
  *
  *  Possible options:
  *	 - none
  *	
  *
  *	@return bool
  */
 function del_credentials($uid, $did, $uname, $realm, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table name */
     $t_name =& $config->data_sql->credentials->table_name;
     /* col names */
     $c =& $config->data_sql->credentials->cols;
     /* flags */
     $f =& $config->data_sql->credentials->flag_values;
     $q = "delete from " . $t_name . "\n\t\t      where " . $c->uid . "   = " . $this->sql_format($uid, "s") . " and\n\t\t            " . $c->uname . " = " . $this->sql_format($uname, "s") . " and\n\t\t            " . $c->realm . " = " . $this->sql_format($realm, "s");
     if ($config->auth['use_did']) {
         $q .= " and " . $c->did . " = " . $this->sql_format($did, "s");
     }
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:36,代码来源:method.del_credentials.php


示例19: serve

 public function serve()
 {
     try {
         NeechySecurity::start_session();
         NeechySecurity::prevent_csrf();
         $this->request = NeechyRequest::load();
         $this->validate_environment();
         $handler = $this->load_handler();
         $response = $handler->handle();
     } catch (NeechyError $e) {
         $handler = new ErrorHandler($this->request);
         $response = $handler->handle_error($e);
     }
     $response->send_headers();
     $response->render();
 }
开发者ID:klenwell,项目名称:neechy-app-engine,代码行数:16,代码来源:web.php


示例20: Handler

 public static function Handler($errNo, $errStr, $errFile, $errLine)
 {
     $backtrace = ErrorHandler::GetBacktrace(2);
     //Creating error message.
     $error_message = "\nErrNo: {$errNo}\n TEXT: {$errStr}\n LOCATION: {$errFile}\n LINE: {$errLine} at" . date('F j, Y, g:i:a') . " Showing Backtrace: {$backtrace}" . "\n";
     if (LOG_ERRORS) {
         error_log($error_message, 3, LOG_ERROR_FILE);
     }
     if (SEND_ERROR_MAIL == true) {
         error_log($error_message, 1, ADMIN_ERROR_MAIL, "From: " . SENDMAIL_FROM . "\r\nTo: " . ADMIN_ERROR_MAIL);
     }
     if ($errNo == E_WARNING && IS_WARNING_FATAL == false || ($errNo == E_NOTICE || $errNo == E_USER_NOTICE)) {
         if (DEBUGGING) {
             echo '<div class="error_box"> <b> <pre>' . $error_message . '</pre> </b> </div>';
         }
     } else {
         if (DEBUGGING) {
             echo '<div class="error_box"> <b> <pre>' . $error_message . '</pre> </b> </div>';
         } else {
             echo SITE_GENERIC_FORM_MESSAGE;
             ob_clean();
             include '500.php';
             flush();
             ob_flush();
             ob_end_clean();
             exit;
         }
         exit;
     }
 }
开发者ID:shubhamsharma24,项目名称:Website-EffervescenceMMXIV,代码行数:30,代码来源:Error_handler.class.php



注:本文中的ErrorHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ErrorPage类代码示例发布时间:2022-05-23
下一篇:
PHP ErrorException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap