Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.7 add quote on value cause errors #32

Open
vafrcor opened this issue Mar 23, 2017 · 5 comments
Open

2.0.7 add quote on value cause errors #32

vafrcor opened this issue Mar 23, 2017 · 5 comments

Comments

@vafrcor
Copy link

vafrcor commented Mar 23, 2017

adding quote while update value cause an error (ENV couldn't be readed) due to many quotes.
Tested on Laravel 5.4 on Mac OS X

@vafrcor
Copy link
Author

vafrcor commented Mar 23, 2017

solution: add quote only for value which contain space character.

// ..
if(preg_match('/\s/',$value) > 0){
  $value='"'.$value.'"';
}
//..

@Brotzka
Copy link
Owner

Brotzka commented Mar 31, 2017

Hey,
Thanks for the tip. Please create a pull request ;(

VegaTom added a commit to VegaTom/laravel-dotenv-editor that referenced this issue Apr 11, 2017
Brotzka added a commit that referenced this issue Apr 27, 2017
2.0.7 add quote on value cause errors #32
Brotzka added a commit that referenced this issue May 7, 2017
Fixed overquoting on quotes
@lostncg
Copy link

lostncg commented Jun 23, 2017

if (preg_match('/\s/', $value) > 0 && (strpos($value, '"') > 0 && strpos($value, '"', -0) > 0)) {
	$value = '"' . $value . '"';
}

If value provided have empty space in string, contain quote in string and contain quote in last space, then add double quote on start and the end of string

"value to test" => value to test (when display)

am I mis-understanding on solution above?

@lostncg
Copy link

lostncg commented Jun 23, 2017

If I didn't mis-understanding, a string contain empty space should be wrapped by double quote, but the truth is, when I save a value contain empty space into .env, bug below occurs because it didn't be wrapped by double quote...

Bug may occurs if empty space in .env

Uncaught ReflectionException: Class config does not exist in

@Corvisier
Copy link
Contributor

@lostncg having the same issues...

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

No branches or pull requests

4 participants