本文整理汇总了PHP中PMA_Error::getHash方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Error::getHash方法的具体用法?PHP PMA_Error::getHash怎么用?PHP PMA_Error::getHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Error
的用法示例。
在下文中一共展示了PMA_Error::getHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addError
/**
* Add an error; can also be called directly (with or without escaping)
*
* The following error types cannot be handled with a user defined function:
* E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR,
* E_COMPILE_WARNING,
* and most of E_STRICT raised in the file where set_error_handler() is called.
*
* Do not use the context parameter as we want to avoid storing the
* complete $GLOBALS inside $_SESSION['errors']
*
* @param string $errstr error string
* @param integer $errno error number
* @param string $errfile error file
* @param integer $errline error line
* @param boolean $escape whether to escape the error string
*
* @return void
*/
public function addError($errstr, $errno, $errfile, $errline, $escape = true)
{
if ($escape) {
$errstr = htmlspecialchars($errstr);
}
// create error object
$error = new PMA_Error($errno, $errstr, $errfile, $errline);
// do not repeat errors
$this->errors[$error->getHash()] = $error;
switch ($error->getNumber()) {
case E_USER_NOTICE:
case E_USER_WARNING:
case E_STRICT:
case E_DEPRECATED:
case E_NOTICE:
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_ERROR:
case E_RECOVERABLE_ERROR:
// just collect the error
// display is called from outside
break;
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
default:
// FATAL error, display it and exit
$this->dispFatalError($error);
exit;
}
}
示例2: handleError
/**
* Error handler - called when errors are triggered/occured
*
* The following error types cannot be handled with a user defined function:
* E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR,
* E_COMPILE_WARNING,
* and most of E_STRICT raised in the file where set_error_handler() is called.
*
* @uses E_USER_NOTICE
* @uses E_USER_WARNING
* @uses E_STRICT
* @uses E_NOTICE
* @uses E_WARNING
* @uses E_CORE_WARNING
* @uses E_COMPILE_WARNING
* @uses E_USER_ERROR
* @uses E_ERROR
* @uses E_PARSE
* @uses E_CORE_ERROR
* @uses E_COMPILE_ERROR
* @uses E_RECOVERABLE_ERROR
* @uses PMA_Error
* @uses PMA_Error_Handler::$_errors
* @uses PMA_Error_Handler::_dispFatalError()
* @uses PMA_Error::getHash()
* @uses PMA_Error::getNumber()
* @param integer $errno
* @param string $errstr
* @param string $errfile
* @param integer $errline
* @param array $errcontext
*/
public function handleError($errno, $errstr, $errfile, $errline, $errcontext)
{
// create error object
$error = new PMA_Error($errno, $errstr, $errfile, $errline, $errcontext);
// do not repeat errors
$this->_errors[$error->getHash()] = $error;
switch ($error->getNumber()) {
case E_USER_NOTICE:
case E_USER_WARNING:
case E_STRICT:
case E_DEPRECATED:
case E_NOTICE:
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_ERROR:
case E_RECOVERABLE_ERROR:
// just collect the error
// display is called from outside
break;
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
default:
// FATAL error, dislay it and exit
$this->_dispFatalError($error);
exit;
break;
}
}