diff --git a/application/config/error.php b/application/config/error.php index c63ba57e..03e3b655 100644 --- a/application/config/error.php +++ b/application/config/error.php @@ -2,6 +2,19 @@ return array( + /* + |-------------------------------------------------------------------------- + | Ignored Error Levels + |-------------------------------------------------------------------------- + | + | Here you may specify the error levels that should be ignored by the + | Laravel error handler. These levels will still be logged; however, no + | information about about them will be displayed. + | + */ + + 'ignore' => array(E_NOTICE, E_USER_NOTICE, E_DEPRECATED, E_USER_DEPRECATED), + /* |-------------------------------------------------------------------------- | Error Detail @@ -29,7 +42,7 @@ | */ - 'log' => false, + 'log' => true, /* |-------------------------------------------------------------------------- @@ -46,17 +59,15 @@ | a single text file within the application storage directory. | | Of course, you are free to implement more complex solutions including - | e-mailing the exceptions details to your team, etc. + | emailing the exceptions details to your team, etc. | */ - 'logger' => function($e, $config) + 'logger' => function($exception) { - $format = '%s | Message: %s | File: %s | Line: %s'; + $message = (string) $exception; - $message = sprintf($format, date('Y-m-d H:i:s'), $e->getMessage(), $e->getFile(), $e->getLine()); - - File::append(STORAGE_PATH.'log.txt', $message.PHP_EOL); - } + File::append(STORAGE_PATH.'log.txt', date('Y-m-d H:i:s').' - '.$message.PHP_EOL); + }, ); \ No newline at end of file diff --git a/laravel/bootstrap/core.php b/laravel/bootstrap/core.php index c8378bc0..8442839d 100644 --- a/laravel/bootstrap/core.php +++ b/laravel/bootstrap/core.php @@ -58,6 +58,7 @@ */ Config::load('application'); Config::load('session'); +Config::load('error'); /** * Register the Autoloader's "load" method on the auto-loader stack. diff --git a/laravel/hash.php b/laravel/hash.php index a1eabcd6..5c978b75 100644 --- a/laravel/hash.php +++ b/laravel/hash.php @@ -5,11 +5,10 @@ class Hash { /** * Hash a password using the Bcrypt hashing scheme. * - * Bcrypt provides a future-proof hashing algorithm by allowing the - * number of "rounds" to be increased, thus increasing the time it - * takes to generate the hashed value. The longer it takes takes - * to generate the hash, the more impractical a rainbow table - * attack against the hashes becomes. + * Bcrypt provides a future-proof hashing algorithm by allowing the number of + * "rounds" to be increased, thus increasing the time it takes to generate the + * hashed value. The longer it takes takes to generate the hash, the more + * impractical a rainbow table attack against the hashes becomes. * * * // Create a Bcrypt hash of a value diff --git a/laravel/laravel.php b/laravel/laravel.php index 36fe6def..3545e83f 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -23,16 +23,16 @@ */ $handler = function($exception) { - $config = Config::get('error'); + $config = Config::$items['error']; if ($config['log']) { - call_user_func($config['logger'], $exception, $config); + call_user_func($config['logger'], $exception); } if ($config['detail']) { - echo "

Uncaught Exception

+ echo "

Unhandled Exception

Message:

".$exception->getMessage()."

Location:

@@ -44,6 +44,8 @@ { Response::error('500')->send(); } + + exit(1); }; /** @@ -61,9 +63,14 @@ * handler, which will convert the error into an ErrorException object * and pass the exception into the common exception handler. */ -set_error_handler(function($number, $error, $file, $line) use ($handler) +set_error_handler(function($number, $error, $file, $line) { - $handler(new \ErrorException($error, $number, 0, $file, $line)); + if (error_reporting() === 0 or in_array($number, Config::$items['error']['ignore'])) + { + return; + } + + throw new \ErrorException($error, $number, 0, $file, $line); }); /** @@ -212,4 +219,4 @@ IoC::core('session')->save($driver); } -$response->send(); +$response->send(); \ No newline at end of file diff --git a/laravel/request.php b/laravel/request.php index eb46430e..303b88ed 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -2,13 +2,6 @@ class Request { - /** - * The request URI for the current request. - * - * @var string - */ - public static $uri; - /** * The route handling the current request. * diff --git a/laravel/uri.php b/laravel/uri.php index 42e106c4..54f188bd 100644 --- a/laravel/uri.php +++ b/laravel/uri.php @@ -7,7 +7,7 @@ class URI { * * @var string */ - protected static $uri; + public static $uri; /** * The URI segments for the current request.