From 18b326d22d831e1fe05e737209e367e30796d5f3 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 8 Nov 2024 13:12:42 +1000 Subject: [PATCH] only use argv on console --- src/Illuminate/Foundation/Application.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 1a6ecc195856..659cf1bd3483 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -759,7 +759,9 @@ public function isProduction() */ public function detectEnvironment(Closure $callback) { - $args = $_SERVER['argv'] ?? null; + $args = $this->runningInConsole() && $_SERVER['argv'] + ? $_SERVER['argv'] + : null; return $this['env'] = (new EnvironmentDetector)->detect($callback, $args); }