Skip to content

[5.8] Allow console environment argument to be separated with a space#28869

Merged
taylorotwell merged 1 commit intolaravel:5.8from
ThibaudDauce:console-environment-separated-with-space
Jun 17, 2019
Merged

[5.8] Allow console environment argument to be separated with a space#28869
taylorotwell merged 1 commit intolaravel:5.8from
ThibaudDauce:console-environment-separated-with-space

Conversation

@ThibaudDauce
Copy link
Contributor

Following explanations are from @matt-allan in the issue #28831:

The Symfony console component that is used by the Artisan console allows separating option names and values with either a space or an equals (=) sign. For example:

$ php artisan serve --port=9090 
Laravel development server started: <http://127.0.0.1:9090>
$ php artisan serve --port 9090 
Laravel development server started: <http://127.0.0.1:9090>

However, the --env option is only parsed correctly if you use an equals sign. If you use a space app()->environment() will return false.

This inconsistency is pretty confusing and difficult to debug. If you dump $this->option('env') in a command it will return the expected value but app()->environment() will return false.

Fixes #28831

@taylorotwell taylorotwell merged commit 85137e0 into laravel:5.8 Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EnvironmentDetector doesn't parse options separated with a space

2 participants