Skip to content

Commit 305ae5e

Browse files
[VarDumper] Use "C" locale when using "comma" flags
1 parent 0bd1f09 commit 305ae5e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ public function setIndentPad($pad)
123123
*/
124124
public function dump(Data $data, $output = null)
125125
{
126+
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) {
127+
setlocale(LC_NUMERIC, 'C');
128+
}
129+
126130
if ($returnDump = true === $output) {
127131
$output = fopen('php://memory', 'r+b');
128132
}
@@ -143,6 +147,9 @@ public function dump(Data $data, $output = null)
143147
if ($output) {
144148
$this->setOutput($prevOutput);
145149
}
150+
if ($locale) {
151+
setlocale(LC_NUMERIC, $locale);
152+
}
146153
}
147154
}
148155

0 commit comments

Comments
 (0)