From 1c10e4ff6dfca0761a6822eae2146a02edffde89 Mon Sep 17 00:00:00 2001 From: Cosmin Ardeleanu Date: Fri, 9 Dec 2022 18:44:13 +0200 Subject: [PATCH] Return 500 http error, instead of 200, when dotenv fails to load (#45235) * Return 500 http error, instead of 200 When dotenv fails, the response on http is always 200. Because of 200 response, alerts might not be triggered, and data will be cached :( * Update LoadEnvironmentVariables.php Co-authored-by: Taylor Otwell --- .../Foundation/Bootstrap/LoadEnvironmentVariables.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php index 64f32ebf41b6..3f0be6c0a605 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php @@ -103,6 +103,8 @@ protected function writeErrorAndDie(InvalidFileException $e) $output->writeln('The environment file is invalid!'); $output->writeln($e->getMessage()); + http_response_code(500); + exit(1); } }