flex-env icon indicating copy to clipboard operation
flex-env copied to clipboard

"env:set" does not support non-alphabetical characters

Open svytas opened this issue 6 years ago • 6 comments

Did you try to set a value with a plus character? The result will surprise you: .env file:

[email protected] MAIL_PASSWORD=hy6gGbS+ MAIL_ENCRYPTION=tls

Executing command: php artisan env:set MAIL_PASSWORD ABCDEF+ Result file looks like this:

[email protected] MAIL_PASSWORD=ABCDEF+ + MAIL_ENCRYPTION=tls

If your old value has other charaters, you get error: .env file:

[email protected] MAIL_PASSWORD=hy6^gGbS+ MAIL_ENCRYPTION=tls

Executing command: php artisan env:set MAIL_PASSWORD ABCDEF+ got error Could not set the value in your .env file, reverting...

The problem is preg_replace function...

svytas avatar Aug 20 '18 05:08 svytas

Ah, well spotted! Seems like you've already identified the bug, can you submit a PR to fix this? If not, I'll have a look at this later next week 🙂

svenluijten avatar Aug 28 '18 20:08 svenluijten

Sorry @svenluijten, a little busy at this time for PR.

svytas avatar Aug 29 '18 10:08 svytas

No worries @svytas! I'll pick it up as soon as I can make some time 😄

svenluijten avatar Aug 29 '18 10:08 svenluijten

fixed by #38

svenluijten avatar Oct 02 '18 10:10 svenluijten

Hi, still it works strange - looks like I cannot change value if there are no numbers in it:

vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD 2 Successfully set [MAIL_PASSWORD] to [2] in your .env file. vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD 2A Successfully set [MAIL_PASSWORD] to [2A] in your .env file. vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD A2 Successfully set [MAIL_PASSWORD] to [A2] in your .env file. vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD X2 Successfully set [MAIL_PASSWORD] to [X2] in your .env file. vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD X2X Successfully set [MAIL_PASSWORD] to [X2X] in your .env file. vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD X2+X Successfully set [MAIL_PASSWORD] to [X2+X] in your .env file. vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD XX Could not set the value in your .env file, reverting... vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD XXDD Could not set the value in your .env file, reverting... vagrant@homestead:/test$ php artisan env:set MAIL_PASSWORD AA Could not set the value in your .env file, reverting...

svytas avatar Oct 26 '18 09:10 svytas

That's... very strange. This package desperately needs a rewrite / big refactor anyway, I'll see what I can do!

svenluijten avatar Oct 26 '18 11:10 svenluijten