diff --git a/lib/src/dispatcher.php b/lib/src/dispatcher.php
index e8a59f6..acd1693 100644
--- a/lib/src/dispatcher.php
+++ b/lib/src/dispatcher.php
@@ -146,7 +146,7 @@ function trails_error($exception) {
ob_clean();
# show details for local requests
- $detailed = $_SERVER['REMOTE_ADDR'] === '127.0.0.1';
+ $detailed = @$_SERVER['REMOTE_ADDR'] === '127.0.0.1';
$body = sprintf('
Trails Error'.
'%s
%s
',
@@ -256,10 +256,7 @@ function load_controller($controller) {
* @return void
*/
function error_handler($errno, $string, $file, $line, $context) {
- $e = new Trails_Exception(500, $string);
- $e->line = $line;
- $e->file = $file;
- throw $e;
+ throw new Trails_Exception(500, $string);
}
}
diff --git a/lib/src/exception.php b/lib/src/exception.php
index 512a3e9..4c21831 100644
--- a/lib/src/exception.php
+++ b/lib/src/exception.php
@@ -22,11 +22,11 @@ class Trails_Exception extends Exception {
/**
- *
- *
- * @param type
+ * @param int the status code to be set in the response
+ * @param string a human readable presentation of the status code
+ * @param array a hash of additional headers to be set in the response
*
- * @return type
+ * @return void
*/
function __construct($status = 500, $reason = NULL, $headers = array()) {
if ($reason === NULL) {
diff --git a/test/lib/dispatcher_test.php b/test/lib/dispatcher_test.php
index 2a5e762..2f3a9df 100644
--- a/test/lib/dispatcher_test.php
+++ b/test/lib/dispatcher_test.php
@@ -38,7 +38,7 @@ function setUpFS() {
ArrayFileStream::set_filesystem(array(
'app' => array(
'controllers' => array(
- 'foo.php' => '',
+ 'foo.php' => ''
),
),
));
@@ -57,7 +57,7 @@ function test_should_instantiate_controller() {
$this->dispatcher->expectOnce('load_controller', array('foo'));
$this->dispatcher->setReturnValue('load_controller', $controller);
$this->dispatcher->expectOnce('parse');
- $this->dispatcher->setReturnValue('parse', array('foo'));
+ $this->dispatcher->setReturnValue('parse', array('foo', ''));
$result = $this->dispatcher->dispatch("/foo");
}
@@ -77,3 +77,4 @@ function test_should_throw_an_exception_if_default_controller_could_not_be_found
$dispatcher->dispatch("");
}
}
+