[VarDumper] Use "C" locale when using "comma" flags

This commit is contained in:
Nicolas Grekas 2017-07-18 18:05:00 +02:00
parent 0bd1f09152
commit 305ae5e5d4

View File

@ -123,6 +123,10 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*/
public function dump(Data $data, $output = null)
{
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) {
setlocale(LC_NUMERIC, 'C');
}
if ($returnDump = true === $output) {
$output = fopen('php://memory', 'r+b');
}
@ -143,6 +147,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
if ($output) {
$this->setOutput($prevOutput);
}
if ($locale) {
setlocale(LC_NUMERIC, $locale);
}
}
}