Source for file Error.php
Documentation is available at Error.php
// vim: foldmethod=marker
* @author Masaki Fujimoto <fujimoto@php.net>
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
* @version $Id: 90163f82f7d1e6b9cd7ff17912f64935b341d5f0 $
// {{{ ethna_error_handler
* @param int $errno エラーレベル
* @param string $errstr エラーメッセージ
* @param string $errfile エラー発生箇所のファイル名
* @param string $errline エラー発生箇所の行番号
$php_errno =
'Fatal error'; break;
$php_errno =
'Warning'; break;
$php_errno =
'Parse error'; break;
$php_errno =
'Notice'; break;
$php_errno =
'Deprecated'; break;
case E_RECOVERABLE_ERROR:
$php_errno =
'Recoverable error'; break;
$php_errno =
'Unknown error'; break;
$php_errstr =
sprintf('PHP %s: %s in %s on line %d',
$php_errno, $errstr, $errfile, $errline);
$logger =
$c->getLogger();
$logger->log($level, sprintf("[PHP] %s: %s in %s on line %d",
$name, $errstr, $errfile, $errline));
// ignore these errors because so many errors occurs in external libraries (like PEAR)
if ($errno ===
E_STRICT) {
if ($errno ===
E_RECOVERABLE_ERROR) {
$config =
$c->getConfig();
$is_debug =
$config->get('debug');
$facility =
$logger->getLogFacility();
?
in_array('echo', $facility) :
$facility ===
'echo';
if ($is_debug ==
true &&
$has_echo ===
false
// {{{ ethna_exception_handler
// TODO: Implement ethna_exception_handler function.
* @author Masaki Fujimoto <fujimoto@php.net>
/** @protected object Ethna_I18N i18nオブジェクト */
/** @protected object Ethna_Logger loggerオブジェクト */
/** @protected string エラーメッセージ */
/** @protected integer エラーコード */
/** @protected integer エラーモード */
/** @protected array エラーモード依存のオプション */
/** @protected string ユーザー定義もしくはデバッグ関連の追加情報を記した文字列。 */
* $userinfo は第5引数に設定すること。
* @param string $message エラーメッセージ
* @param int $code エラーコード
* @param int $mode エラーモード(Ethna_Errorはコールバックを
* @param array $options エラーモード依存のオプション
* @param array $userinfo エラー追加情報($options より後の全ての引数)
* @see http://pear.php.net/manual/ja/core.pear.pear-error.pear-error.php
public function __construct($message =
null, $code =
null, $mode =
null, $options =
null)
if ($controller !==
null) {
$this->i18n =
$controller->getI18N();
// $options 以降の引数 -> $userinfo
if (count($userinfo) ==
1) {
} else if (is_null($userinfo[0])) {
$message =
$controller->getErrorMessage($code);
$message =
'unknown error';
$this->level =
($this->options ===
NULL) ?
E_USER_NOTICE :
$options;
// Ethnaフレームワークのエラーハンドラ(callback)
* エラーオブジェクトに関連付けられたエラーコードを返します。
* @return integer - エラー番号
* - $userinfoとして渡されたデータによるvsprintf()処理
* @return string エラーメッセージ
$tmp_message_arg_list =
array();
for ($i =
0; $i <
count($tmp_userinfo); $i++
) {
$tmp_message_arg_list[] =
$this->i18n ?
$this->i18n->get($tmp_userinfo[$i]) :
$tmp_userinfo[$i];
return vsprintf($tmp_message, $tmp_message_arg_list);
* エラー追加情報配列の個々のエントリへのアクセスをサポート
* @param int $n エラー追加情報のインデックス(省略可)
* @return mixed message引数
* @param string $info 追加するエラー情報
Documentation generated on Fri, 11 Nov 2011 03:58:02 +0900 by phpDocumentor 1.4.3