Did some improvements

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-15 19:25:33 +01:00
parent 4ddb8a298b
commit fe7595e313
7 changed files with 25 additions and 12 deletions

View file

@ -34,7 +34,7 @@ ini_set("display_errors", 1);
ini_set('default_charset', 'utf-8');
define("FILE_PATH", dirname(__FILE__)."/../../");
set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH . PATH_SEPARATOR . FILE_PATH . "/src/" . PATH_SEPARATOR . FILE_PATH . "/src/classes/");
ini_set("memory_limit", "512M");
ini_set("memory_limit", "256M");
define("LOG", true);
define("MAGIC", "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78");
define("TEST_MD5", "d0ca3786e53b615bb4fb9f5094d5c9a7");

View file

@ -32,7 +32,7 @@ if(strpos(strtoupper(php_uname("s")), "WIN") === false or arg("enable-ansi", fal
}else{
define("ENABLE_ANSI", false);
}
//set_error_handler("error_handler");
set_error_handler("fatal_handler", E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_DEPRECATED);
$errors = 0;

View file

@ -202,8 +202,15 @@ function console($message, $EOL = true, $log = true, $level = 1){
}
}
function error_handler($errno, $errstr, $errfile, $errline){
function fatal_handler($errno, $errstr, $errfile, $errline){
global $lasttrace;
console("[ERROR] A level ".$errno." error happened: \"$errstr\" in \"$errfile\" at line $errline", true, true, 0);
ob_start();
debug_print_backtrace();
$lasttrace = ob_get_contents();
ob_end_clean();
console("[ERROR] [Backtrace] $lasttrace", true, true, 0);
return false;
}
function logg($message, $name, $EOL = true, $level = 2, $close = false){