laravel-dotenv-editor icon indicating copy to clipboard operation
laravel-dotenv-editor copied to clipboard

2.0.7 add quote on value cause errors

Open vafrcor opened this issue 7 years ago • 5 comments

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 avatar Mar 23 '17 08:03 vafrcor

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

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

vafrcor avatar Mar 23 '17 08:03 vafrcor

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

Brotzka avatar Mar 31 '17 19:03 Brotzka

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 avatar Jun 23 '17 02:06 lostncg

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

lostncg avatar Jun 23 '17 02:06 lostncg

@LostNCG having the same issues...

Corvisier avatar Aug 14 '17 20:08 Corvisier