From 75f394308fda210c0ef171ce5ba65bd4242778b8 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Thu, 23 Mar 2017 20:52:52 +0200 Subject: [PATCH 1/2] Handle missing or malformed config/app.php file --- src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php | 6 ++++++ src/Illuminate/Foundation/Exceptions/Handler.php | 2 +- src/Illuminate/Log/LogServiceProvider.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php index 73e517153383..0ea5ecbb825a 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -59,6 +59,12 @@ public function bootstrap(Application $app) */ protected function loadConfigurationFiles(Application $app, RepositoryContract $repository) { + $files = $this->getConfigurationFiles($app); + + if (! isset($files['app'])) { + throw new \Exception('Unable not load the config/app.php file.'); + } + foreach ($this->getConfigurationFiles($app) as $key => $path) { $repository->set($key, require $path); } diff --git a/src/Illuminate/Foundation/Exceptions/Handler.php b/src/Illuminate/Foundation/Exceptions/Handler.php index da6011c0359a..f8da3961e08a 100644 --- a/src/Illuminate/Foundation/Exceptions/Handler.php +++ b/src/Illuminate/Foundation/Exceptions/Handler.php @@ -208,7 +208,7 @@ protected function convertExceptionToResponse(Exception $e) { $e = FlattenException::create($e); - $handler = new SymfonyExceptionHandler(config('app.debug')); + $handler = new SymfonyExceptionHandler(config('app.debug', true)); return SymfonyResponse::create($handler->getHtml($e), $e->getStatusCode(), $e->getHeaders()); } diff --git a/src/Illuminate/Log/LogServiceProvider.php b/src/Illuminate/Log/LogServiceProvider.php index 065eaae28add..a927dbf98901 100644 --- a/src/Illuminate/Log/LogServiceProvider.php +++ b/src/Illuminate/Log/LogServiceProvider.php @@ -118,7 +118,7 @@ protected function configureErrorlogHandler(Writer $log) protected function handler() { if ($this->app->bound('config')) { - return $this->app->make('config')->get('app.log'); + return $this->app->make('config')->get('app.log', 'single'); } return 'single'; From aae7a9e2f4aaf2ecd29114767959ab84e13c27cc Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Fri, 24 Mar 2017 09:32:51 +0200 Subject: [PATCH 2/2] typo --- src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php index 0ea5ecbb825a..19aefbc170f9 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -62,7 +62,7 @@ protected function loadConfigurationFiles(Application $app, RepositoryContract $ $files = $this->getConfigurationFiles($app); if (! isset($files['app'])) { - throw new \Exception('Unable not load the config/app.php file.'); + throw new \Exception('Unable to load the config/app.php file.'); } foreach ($this->getConfigurationFiles($app) as $key => $path) {