Security update for Core, with self-updated composer
[yaffs-website] / vendor / psy / psysh / src / Psy / VarDumper / Presenter.php
index 935b6e7016b976af99468aa570ab4854b3e94db7..b48ca9ddd6a35e967456c724e86ef756bdb6db90 100644 (file)
@@ -46,11 +46,18 @@ class Presenter
         '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) {
@@ -108,6 +115,10 @@ class Presenter
             $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) {
@@ -118,6 +129,9 @@ class Presenter
             }
         });
 
+        // Now put the locale back
+        setlocale(LC_NUMERIC, $oldLocale);
+
         return OutputFormatter::escape($output);
     }
 }