'index' => 'number',
);
- public function __construct(OutputFormatter $formatter)
+ public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
{
- $this->dumper = new Dumper($formatter);
+ // Work around https://github.com/symfony/symfony/issues/23572
+ $oldLocale = setlocale(LC_NUMERIC, 0);
+ setlocale(LC_NUMERIC, 'C');
+
+ $this->dumper = new Dumper($formatter, $forceArrayIndexes);
$this->dumper->setStyles($this->styles);
+ // Now put the locale back
+ setlocale(LC_NUMERIC, $oldLocale);
+
$this->cloner = new Cloner();
$this->cloner->addCasters(array('*' => function ($obj, array $a, Stub $stub, $isNested, $filter = 0) {
if ($filter || $isNested) {
$data = $data->withMaxDepth($depth);
}
+ // Work around https://github.com/symfony/symfony/issues/23572
+ $oldLocale = setlocale(LC_NUMERIC, 0);
+ setlocale(LC_NUMERIC, 'C');
+
$output = '';
$this->dumper->dump($data, function ($line, $depth) use (&$output) {
if ($depth >= 0) {
}
});
+ // Now put the locale back
+ setlocale(LC_NUMERIC, $oldLocale);
+
return OutputFormatter::escape($output);
}
}