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

View file

@ -170,10 +170,10 @@ class Route
* @throws RouterNonExistentControllerException * @throws RouterNonExistentControllerException
* @return mixed * @return mixed
*/ */
public function fire() public function fire($params = [])
{ {
if (is_callable($this->action)) { if (is_callable($this->action)) {
return call_user_func($this->action); return call_user_func_array($this->action, $params);
} }
if (!class_exists($this->controller) if (!class_exists($this->controller)
@ -181,6 +181,6 @@ class Route
throw new RouterNonExistentControllerException; 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->addConnection(config('database'));
$capsule->setAsGlobal(); $capsule->setAsGlobal();
class_alias(Router\Collection::class, 'Router');
if (!defined('IN_CLI')) { if (!defined('IN_CLI')) {
// Start output buffering // Start output buffering
ob_start(config('performance.compression') ? 'ob_gzhandler' : null); ob_start(config('performance.compression') ? 'ob_gzhandler' : null);

View file

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