From 07fab31e0f55c462467302788aa83a46d675e9dc Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 22 Feb 2011 10:36:09 -0600 Subject: [PATCH] modified: lib/lib_common.php modified: yotsubanome.php --- lib/lib_common.php | 16 ++++++++++++++++ yotsubanome.php | 10 +++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/lib_common.php b/lib/lib_common.php index 287095a..ebf918b 100755 --- a/lib/lib_common.php +++ b/lib/lib_common.php @@ -9,6 +9,22 @@ * @date $Date: 2009-04-06 09:30:13 +0800 (星期一, 06 四月 2009) $ */ +/** + * 更改 PHP 捕捉錯誤功能並顯示自訂錯誤 + */ +function PMCCore_errorHandler($errno, $errstr, $errfile, $errline){ + header('Content-type: text/plain;charset=utf-8'); + switch($errno){ + case E_USER_ERROR: + case E_ERROR: + exit('Error: '.$errstr); + break; + case E_WARNING: + exit('Warning: '.$errstr.' '.$errfile.' #'.$errline); + break; + } +} + /* css data */ $style_load = false; $style_bar = ''; diff --git a/yotsubanome.php b/yotsubanome.php index 06b06e4..26fe204 100755 --- a/yotsubanome.php +++ b/yotsubanome.php @@ -52,7 +52,15 @@ PHP 4.4.9 或更高版本並開啟 GD 和 Zlib 支援,如支援 ImageMagick 說明條目可資參考。 */ -error_reporting(E_ALL); // show all errors for debugging + +if(version_compare(PHP_VERSION, '5.0.0', '>=')){ // PHP5+ + set_error_handler('PMCCore_errorHandler', E_ERROR | E_WARNING | E_USER_ERROR); // Handle Errors +}else{ + set_error_handler('PMCCore_errorHandler'); +} + + +//error_reporting(E_ALL); // show all errors for debugging /* Enviorment Settings */ // Do not change unless you renamed the directories -- 2.39.5