Upgrade to 3.0.2
This commit is contained in:
@@ -50,6 +50,9 @@ class Txt extends Handler
|
||||
// avoid problems with arrays
|
||||
if (is_array($value) === true) {
|
||||
$value = Yaml::encode($value);
|
||||
// avoid problems with localized floats
|
||||
} elseif (is_float($value) === true) {
|
||||
$value = Str::float($value);
|
||||
}
|
||||
|
||||
// escape accidental dividers within a field
|
||||
|
@@ -25,8 +25,19 @@ class Yaml extends Handler
|
||||
*/
|
||||
public static function encode(array $data): string
|
||||
{
|
||||
// fetch the current locale setting for numbers
|
||||
$locale = setlocale(LC_NUMERIC, 0);
|
||||
|
||||
// change to english numerics to avoid issues with floats
|
||||
setlocale(LC_NUMERIC, 'en_US');
|
||||
|
||||
// $data, $indent, $wordwrap, $no_opening_dashes
|
||||
return Spyc::YAMLDump($data, false, false, true);
|
||||
$yaml = Spyc::YAMLDump($data, false, false, true);
|
||||
|
||||
// restore the previous locale settings
|
||||
setlocale(LC_NUMERIC, $locale);
|
||||
|
||||
return $yaml;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user