fix EnvironmentManager updateEnv (#60)

* fix EnvironmentManager updateEnv

* fix EnvironmentManager encode method

* fix code style
This commit is contained in:
Timo
2024-05-04 10:35:35 +02:00
committed by GitHub
parent 2784318ebf
commit 6ea112c04f
2 changed files with 4 additions and 3 deletions

View File

@@ -64,8 +64,6 @@ class EnvironmentManager
if ($entry[0] == $data_key) {
$env[$env_key] = $data_key.'='.$this->encode($data_value);
$updated = true;
} else {
$env[$env_key] = $this->encode($env_value);
}
}
@@ -90,7 +88,7 @@ class EnvironmentManager
private function encode($str)
{
if (strpos($str, ' ') !== false || preg_match('/'.preg_quote('^\'£$%^&*()}{@#~?><,@|-=-_+-¬', '/').'/', $str)) {
if ((strpos($str, ' ') !== false || preg_match('/'.preg_quote('^\'£$%^&*()}{@#~?><,@|-=-_+-¬', '/').'/', $str)) && ($str[0] != '"' || $str[strlen($str) - 1] != '"')) {
$str = '"'.$str.'"';
}