From aae82d9118eb8ff3ca63868f401dff71197d90f6 Mon Sep 17 00:00:00 2001 From: Samuel Ryan Date: Tue, 13 Feb 2018 16:22:56 +0000 Subject: [PATCH 1/3] Catches InvalidFileException when loading environment file with dotenv --- .../Foundation/Bootstrap/LoadEnvironmentVariables.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php index cc9196dcfcc6..c502ecd6542b 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php @@ -4,6 +4,7 @@ use Dotenv\Dotenv; use Dotenv\Exception\InvalidPathException; +use Dotenv\Exception\InvalidFileException; use Symfony\Component\Console\Input\ArgvInput; use Illuminate\Contracts\Foundation\Application; @@ -25,7 +26,7 @@ public function bootstrap(Application $app) try { (new Dotenv($app->environmentPath(), $app->environmentFile()))->load(); - } catch (InvalidPathException $e) { + } catch (InvalidPathException | InvalidFileException $e) { // } } From 7a3635a6191d89de111094bebaa88be85b304c51 Mon Sep 17 00:00:00 2001 From: Samuel Ryan Date: Tue, 13 Feb 2018 16:56:21 +0000 Subject: [PATCH 2/3] Orders imports alphabetically --- .../Foundation/Bootstrap/LoadEnvironmentVariables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php index c502ecd6542b..9cbebedbe5df 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php @@ -3,8 +3,8 @@ namespace Illuminate\Foundation\Bootstrap; use Dotenv\Dotenv; -use Dotenv\Exception\InvalidPathException; use Dotenv\Exception\InvalidFileException; +use Dotenv\Exception\InvalidPathException; use Symfony\Component\Console\Input\ArgvInput; use Illuminate\Contracts\Foundation\Application; From e64094440a8e6be67c0e6f19abd6cce57b6843ee Mon Sep 17 00:00:00 2001 From: Samuel Ryan Date: Tue, 13 Feb 2018 20:43:09 +0000 Subject: [PATCH 3/3] Adds backwards compatible error checking --- .../Foundation/Bootstrap/LoadEnvironmentVariables.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php index 9cbebedbe5df..f67f3cf061c9 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php @@ -26,8 +26,10 @@ public function bootstrap(Application $app) try { (new Dotenv($app->environmentPath(), $app->environmentFile()))->load(); - } catch (InvalidPathException | InvalidFileException $e) { + } catch (InvalidPathException $e) { // + } catch (InvalidFileException $e) { + dd('Fatal Error: Values in .env containing spaces must be surrounded by quotes.'); } }