From 4b8a042ecaa057a8d4c1bc113693da7c9b3cdaaf Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Mon, 3 Jun 2024 12:14:49 +0200 Subject: [PATCH] Filter environment variables --- src/Illuminate/Foundation/Console/ServeCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index 0c9cd9f5e6b1..83b5a068a86b 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -142,12 +142,12 @@ public function handle() */ protected function startProcess($hasEnvironment) { - $process = new Process($this->serverCommand(), public_path(), collect($_ENV)->mapWithKeys(function ($value, $key) use ($hasEnvironment) { + $process = new Process($this->serverCommand(), public_path(), collect($_ENV)->filter(function ($value, $key) use ($hasEnvironment) { if ($this->option('no-reload') || ! $hasEnvironment) { - return [$key => $value]; + return true; } - return in_array($key, static::$passthroughVariables) ? [$key => $value] : [$key => false]; + return in_array($key, static::$passthroughVariables); })->all()); $this->trap(fn () => [SIGTERM, SIGINT, SIGHUP, SIGUSR1, SIGUSR2, SIGQUIT], function ($signal) use ($process) {