Skip to content

Commit 472072e

Browse files
[VarDumper] Fix dumping floats on PHP8
1 parent f0ffa47 commit 472072e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public function __construct($output = null, string $charset = null, int $flags =
4646
{
4747
$this->flags = $flags;
4848
$this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
49-
$this->decimalPoint = localeconv();
50-
$this->decimalPoint = $this->decimalPoint['decimal_point'];
49+
$this->decimalPoint = \PHP_VERSION_ID >= 80000 ? '.' : localeconv()['decimal_point'];
5150
$this->setOutput($output ?: static::$defaultOutput);
5251
if (!$output && \is_string(static::$defaultOutput)) {
5352
static::$defaultOutput = $this->outputStream;
@@ -122,8 +121,7 @@ public function setIndentPad($pad)
122121
*/
123122
public function dump(Data $data, $output = null)
124123
{
125-
$this->decimalPoint = localeconv();
126-
$this->decimalPoint = $this->decimalPoint['decimal_point'];
124+
$this->decimalPoint = \PHP_VERSION_ID >= 80000 ? '.' : localeconv()['decimal_point'];
127125

128126
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {
129127
setlocale(\LC_NUMERIC, 'C');

0 commit comments

Comments
 (0)