]> 4ch.mooo.com Git - test.git/commitdiff
modified: lib/lib_common.php
authorsparky4 <sparky4@4ch.irc.su>
Tue, 22 Feb 2011 16:36:09 +0000 (10:36 -0600)
committersparky4 <sparky4@4ch.irc.su>
Tue, 22 Feb 2011 16:36:09 +0000 (10:36 -0600)
modified:   yotsubanome.php

lib/lib_common.php
yotsubanome.php

index 287095a645897b4d78f2f26ce2d9b1eb2d096d26..ebf918b850688a497dfc52eac3362730bc2be02e 100755 (executable)
@@ -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 = '';
index 06b06e44fa7eb4647c74a457453057f14ff387d6..26fe2044eea26175978b8be1350edeb5ab0c3983 100755 (executable)
@@ -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