Lazy-load error class inside of error handlers. Speed boost!

This commit is contained in:
Taylor Otwell 2011-06-17 15:03:20 -07:00
parent 90fadb2980
commit 150fa6a3ac
1 changed files with 3 additions and 1 deletions

View File

@ -31,7 +31,6 @@
// Load the configuration, error, and string classes.
// --------------------------------------------------------------
require SYS_PATH.'config'.EXT;
require SYS_PATH.'error'.EXT;
require SYS_PATH.'str'.EXT;
// --------------------------------------------------------------
@ -54,11 +53,13 @@
// --------------------------------------------------------------
set_exception_handler(function($e)
{
require_once SYS_PATH.'error'.EXT;
System\Error::handle($e);
});
set_error_handler(function($number, $error, $file, $line)
{
require_once SYS_PATH.'error'.EXT;
System\Error::handle(new ErrorException($error, 0, $number, $file, $line));
});
@ -66,6 +67,7 @@
{
if ( ! is_null($error = error_get_last()))
{
require_once SYS_PATH.'error'.EXT;
System\Error::handle(new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']));
}
});