--- init.php.orig 2005-09-11 14:58:33.000000000 +0900 +++ init.php 2005-11-15 17:08:49.000000000 +0900 @@ -8,6 +8,62 @@ // // Init PukiWiki here +///////////////////////////////////////////////// +// 初期設定(エラーログ) +ini_set('error_reporting', E_ALL); +$old_error_handler = set_error_handler('myErrorHandler'); + +// エラーハンドラ関数 +function myErrorHandler($no, $str, $file, $line, $variable) +{ + global $vars; + static $messages = array( + 1=>'ERROR', + 2=>'WARNING', + 4=>'PARSE', + 8=>'NOTICE', + 16=>'CORE_ERROR', + 32=>'CORE_WARNING', + 64=>'COMPILE_ERROR', + 128=>'COMPILE_WARNING', + 256=>'USER_ERROR', + 512=>'USER_WARNING', + 1024=>'USER_NOTICE' + ); + static $fatal_errors = array(E_ERROR,E_CORE_ERROR,E_COMPILE_ERROR,E_USER_ERROR); + + if (strpos($str,'getimagesize') === 0) + { + return; + } + + $error = get_date('Y-m-d H:i:s'); + + if ($vars['page'] != '') + { + $error .= ' '.$vars['page']; + } + + foreach ($messages as $_no=>$mes) + { + if ($no & $_no) + { + $error .= ' '.$mes; + } + } + + $error .= "($no)\n"; + $error .= "$str on $file line $line\n"; + $fp = fopen('./cache/errorlog.txt','a') or die; + fwrite($fp,$error); + fclose($fp); + + if (in_array($no,$fatal_errors)) + { + die; + } +} + // PukiWiki version / Copyright / Licence define('S_VERSION', '1.4.6');