Skip to content

Commit

Permalink
check for running in console
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 12, 2024
1 parent 7ccb4dc commit 8c07b63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,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);
}
Expand Down

0 comments on commit 8c07b63

Please sign in to comment.