Removed error filtering and fixed notice errors.

pull/21/head
Mike Cao 12 years ago
parent d081879379
commit 1d84913d7f

@ -74,9 +74,6 @@ class Flight {
// Handle exceptions internally
set_exception_handler(array(__CLASS__, 'handleException'));
// Turn off notices
error_reporting (E_ALL ^ E_NOTICE);
// Fix magic quotes
if (get_magic_quotes_gpc()) {
$func = function ($value) use (&$func) {
@ -132,9 +129,7 @@ class Flight {
* @param int $errline Error file line number
*/
public static function handleError($errno, $errstr, $errfile, $errline) {
if (in_array($errno, array(E_USER_ERROR, E_RECOVERABLE_ERROR))) {
static::handleException(new ErrorException($errstr, 0, $errno, $errfile, $errline));
}
static::handleException(new ErrorException($errstr, $errno, 0, $errfile, $errline));
}
/**
@ -320,9 +315,13 @@ class Flight {
* @param object $e Exception
*/
public static function _error(Exception $e) {
$msg = '<h1>500 Internal Server Error</h1>'.
'<h3>'.$e->getMessage().'</h3>'.
'<pre>'.$e->getTraceAsString().'</pre>';
$msg = sprintf('<h1>500 Internal Server Error</h1>'.
'<h3>%s (%s)</h3>'.
'<pre>%s</pre>',
$e->getMessage(),
$e->getCode(),
$e->getTraceAsString()
);
try {
self::response(false)
@ -417,7 +416,8 @@ class Flight {
self::response()->header('ETag', $id);
if ($_SERVER['HTTP_IF_NONE_MATCH'] === $id) {
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
$_SERVER['HTTP_IF_NONE_MATCH'] === $id) {
self::halt(304);
}
}
@ -430,7 +430,8 @@ class Flight {
public static function _lastModified($time) {
self::response()->header('Last-Modified', date(DATE_RFC1123, $time));
if (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $time) {
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $time) {
self::halt(304);
}
}

@ -34,7 +34,7 @@ class Loader {
*
* @var array
*/
protected $dirs = array();
protected $dirs = array('.', __DIR__);
/**
* Registers a class.
@ -164,9 +164,8 @@ class Loader {
*/
public function autoload($class) {
$class_file = str_replace('\\', '/', str_replace('_', '/', $class)).'.php';
$dirs = array_merge($this->dirs, array(__DIR__, '.'));
foreach ($dirs as $dir) {
foreach ($this->dirs as $dir) {
$file = $dir.'/'.$class_file;
if (file_exists($file)) {
require $file;
@ -175,7 +174,8 @@ class Loader {
}
// Allow other autoloaders to run before raising an error
$loader = array_pop(spl_autoload_functions());
$loaders = spl_autoload_functions();
$loader = array_pop($loaders);
if (is_array($loader) && $loader[0] == __CLASS__ && $loader[1] == __FUNCTION__) {
throw new Exception('Unable to load file: '.$class_file);
}

Loading…
Cancel
Save