This commit is contained in:
flash 2016-09-12 13:13:05 +02:00
parent 1fc9dc060c
commit fda7c71a50
4 changed files with 13 additions and 18 deletions

View file

@ -29,11 +29,7 @@ class ExceptionHandler
*/
public static function exception(Throwable $ex)
{
try {
$report = config('dev.report_host');
} catch (Exception $ex) {
$report = null;
}
$report = config('dev.report_host');
if ($report !== null) {
self::report($ex, $report);
@ -63,13 +59,9 @@ class ExceptionHandler
{
http_response_code(500);
try {
$debug = config('dev.show_errors');
} catch (Exception $ex) {
$debug = false;
}
$debug = config('dev.show_errors');
if ($debug) {
if (true) {
header('Content-Type: text/plain');
echo $ex;
} else {

View file

@ -170,10 +170,10 @@ class Route
* @throws RouterNonExistentControllerException
* @return mixed
*/
public function fire()
public function fire($params = [])
{
if (is_callable($this->action)) {
return call_user_func($this->action);
return call_user_func_array($this->action, $params);
}
if (!class_exists($this->controller)
@ -181,6 +181,6 @@ class Route
throw new RouterNonExistentControllerException;
}
return (new $this->controller)->{$this->action}();
return (new $this->controller)->{$this->action}(...$params);
}
}

View file

@ -50,8 +50,6 @@ $capsule = new DB;
$capsule->addConnection(config('database'));
$capsule->setAsGlobal();
class_alias(Router\Collection::class, 'Router');
if (!defined('IN_CLI')) {
// Start output buffering
ob_start(config('performance.compression') ? 'ob_gzhandler' : null);

View file

@ -4,6 +4,7 @@
*/
use Sakura\Config;
use Sakura\Exceptions\ConfigValueNotFoundException;
use Sakura\Net;
use Sakura\Routerv1;
use Sakura\Template;
@ -17,8 +18,12 @@ function config($value)
try {
return Config::get($section, $key);
} catch (Exception $e) {
return Config::get($value);
} catch (ConfigValueNotFoundException $e) {
try {
return Config::get($value);
} catch (ConfigValueNotFoundException $e) {
return null;
}
}
}