bug #23574 [VarDumper] Move locale sniffing to dump() time (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] Move locale sniffing to dump() time

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23572
| License       | MIT
| Doc PR        | -

Commits
-------

eed8a5143d [VarDumper] Move locale sniffing to dump() time
This commit is contained in:
Fabien Potencier 2017-07-19 06:11:13 +02:00
commit 2040770da5
1 changed files with 5 additions and 2 deletions

View File

@ -39,8 +39,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
public function __construct($output = null, $charset = null)
{
$this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
$this->decimalPoint = (string) 0.5;
$this->decimalPoint = $this->decimalPoint[1];
$this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point'];
$this->setOutput($output ?: static::$defaultOutput);
if (!$output && is_string(static::$defaultOutput)) {
static::$defaultOutput = $this->outputStream;
@ -134,6 +134,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*/
public function dump(Data $data, $output = null)
{
$this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point'];
$exception = null;
if ($output) {
$prevOutput = $this->setOutput($output);