Skip to content

Commit eded6bd

Browse files
committed
check if running in console
1 parent 99fa2e3 commit eded6bd

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
@@ -602,7 +602,9 @@ public function isProduction()
602602
*/
603603
public function detectEnvironment(Closure $callback)
604604
{
605-
$args = $_SERVER['argv'] ?? null;
605+
$args = $this->runningInConsole() && $_SERVER['argv']
606+
? $_SERVER['argv']
607+
: null;
606608

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

0 commit comments

Comments
 (0)