fix writer for false values not separated by komma

This commit is contained in:
norb 2022-11-07 12:41:36 +01:00
commit 50cc1130e2

View file

@ -81,8 +81,8 @@ class SettingsWriter
foreach ($settings as $key => $value) foreach ($settings as $key => $value)
{ {
if (!is_numeric($key)) $key = "'$key'"; $stringKey = (is_numeric($key)) ? $key : "'$key'";
fwrite( $this->handle, "$indent$key =>" ); fwrite( $this->handle, "$indent$stringKey =>" );
// recursive walk through child arrays // recursive walk through child arrays
if ( is_array( $value ) ) if ( is_array( $value ) )
@ -105,7 +105,7 @@ class SettingsWriter
fwrite( $this->handle, " $value" ); fwrite( $this->handle, " $value" );
} }
if ( next($settings) ) if ( array_key_last($settings) !== $key )
{ {
fwrite( $this->handle, "," ); fwrite( $this->handle, "," );
} }