Skip to content

Commit cd25294

Browse files
committed
bug symfony#23575 [VarDumper] Use "C" locale when using "comma" flags (nicolas-grekas)
This PR was merged into the 3.3 branch. Discussion ---------- [VarDumper] Use "C" locale when using "comma" flags | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#23572 | License | MIT | Doc PR | - Adding trailing comma implicitly requires a C locale. Commits ------- 305ae5e [VarDumper] Use "C" locale when using "comma" flags
2 parents 0bd1f09 + 305ae5e commit cd25294

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)