diff --git a/lib/src/dispatcher.php b/lib/src/dispatcher.php index 3db0d1f..05722b8 100644 --- a/lib/src/dispatcher.php +++ b/lib/src/dispatcher.php @@ -84,8 +84,8 @@ function __construct($trails_root, */ function dispatch($uri) { - $old_handler = - set_error_handler(array($this, 'error_handler'), E_ALL); + # E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_RECOVERABLE_ERROR = 5888 + $old_handler = set_error_handler(array($this, 'error_handler'), 5888); ob_start(); $level = ob_get_level(); @@ -245,23 +245,21 @@ function load_controller($controller) { /** - * - * # TODO (mlunzena) add description + * This method transforms E_USER_* and E_RECOVERABLE_ERROR to + * Trails_Exceptions. * - * @param type + * @param integer the level of the error raised + * @param string the error message + * @param string the filename that the error was raised in + * @param integer the line number the error was raised at + * @param array an array of every variable that existed in the scope the + * error was triggered in * - * @return type + * @throws Trails_Exception + * + * @return void */ function error_handler($errno, $string, $file, $line, $context) { - - if (!($errno & error_reporting())) { - return; - } - - if ($errno == E_NOTICE || $errno == E_WARNING || $errno == E_STRICT) { - return FALSE; - } - $e = new Trails_Exception(500, $string); $e->line = $line; $e->file = $file; diff --git a/lib/src/response.php b/lib/src/response.php index b4f0cf2..60376b3 100644 --- a/lib/src/response.php +++ b/lib/src/response.php @@ -149,7 +149,7 @@ function output() { * * @param string the HTTP header * @param bool optional; TRUE if previously sent header should be - * replaced – FALSE otherwise (default) + * replaced - FALSE otherwise (default) * @param integer optional; the HTTP response code * * @return void