bug #23575 [VarDumper] Use "C" locale when using "comma" flags (nicolas-grekas)
This PR was merged into the 3.3 branch.
Discussion
----------
[VarDumper] Use "C" locale when using "comma" flags
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #23572
| License | MIT
| Doc PR | -
Adding trailing comma implicitly requires a C locale.
Commits
-------
305ae5e5d4
[VarDumper] Use "C" locale when using "comma" flags
This commit is contained in:
commit
cd2529432a
@ -123,6 +123,10 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
|||||||
*/
|
*/
|
||||||
public function dump(Data $data, $output = null)
|
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) {
|
if ($returnDump = true === $output) {
|
||||||
$output = fopen('php://memory', 'r+b');
|
$output = fopen('php://memory', 'r+b');
|
||||||
}
|
}
|
||||||
@ -143,6 +147,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
|||||||
if ($output) {
|
if ($output) {
|
||||||
$this->setOutput($prevOutput);
|
$this->setOutput($prevOutput);
|
||||||
}
|
}
|
||||||
|
if ($locale) {
|
||||||
|
setlocale(LC_NUMERIC, $locale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user