Skip to content

Commit dd0b297

Browse files
committed
escape ini quotes
1 parent 57fe746 commit dd0b297

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Format/IniFormat.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@ protected static function getValueAsINI(mixed $value): string
102102
return match (gettype($value)) {
103103
'integer', 'double' => $value,
104104
'boolean' => $value ? 'true' : 'false',
105-
'string' => '"' . str_replace(["\r\n", "\n"], '\\n', $value) . '"',
105+
'string' => '"' . static::escapeString($value) . '"',
106106
};
107107
}
108+
109+
protected static function escapeString(string $value): string
110+
{
111+
$value = str_replace(["\r\n", "\n"], '\\n', $value);
112+
113+
return str_replace('"', '\\"', $value);
114+
}
108115
}

0 commit comments

Comments
 (0)