Skip to content

Commit 8c07b63

Browse files
committed
check for running in console
1 parent 7ccb4dc commit 8c07b63

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Illuminate/Foundation/Application.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,9 @@ public function isProduction()
696696
*/
697697
public function detectEnvironment(Closure $callback)
698698
{
699-
$args = $_SERVER['argv'] ?? null;
699+
$args = $this->runningInConsole() && $_SERVER['argv']
700+
? $_SERVER['argv']
701+
: null;
700702

701703
return $this['env'] = (new EnvironmentDetector)->detect($callback, $args);
702704
}

0 commit comments

Comments
 (0)