Skip to content

Commit eafcac5

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: Update Pbkdf2PasswordHasher.php Bump Symfony version to 6.3.5 Update VERSION for 6.3.4 Update CHANGELOG for 6.3.4 Bump Symfony version to 5.4.29 Update VERSION for 5.4.28 Update CONTRIBUTORS for 5.4.28 Update CHANGELOG for 5.4.28 Fixed attachment base64 content string in MailerSendApiTransport [Security] Prevent creating session in stateless firewalls [Serializer] Fix union of enum denormalization [Serializer] Fix wrong InvalidArgumentException [VarDumper] Fix managing collapse state in CliDumper Fix breaking change in AccessTokenAuthenticator
2 parents 23c7dd6 + 2027be1 commit eafcac5

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Dumper/CliDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public function setDisplayOptions(array $displayOptions)
135135
public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value)
136136
{
137137
$this->dumpKey($cursor);
138+
$this->collapseNextHash = $this->expandNextHash = false;
138139

139140
$style = 'const';
140141
$attr = $cursor->attr;
@@ -198,6 +199,7 @@ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|n
198199
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
199200
{
200201
$this->dumpKey($cursor);
202+
$this->collapseNextHash = $this->expandNextHash = false;
201203
$attr = $cursor->attr;
202204

203205
if ($bin) {
@@ -291,6 +293,7 @@ public function enterHash(Cursor $cursor, int $type, string|int|null $class, boo
291293
$this->colors ??= $this->supportsColors();
292294

293295
$this->dumpKey($cursor);
296+
$this->expandNextHash = false;
294297
$attr = $cursor->attr;
295298

296299
if ($this->collapseNextHash) {

Tests/Dumper/CliDumperTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\VarDumper\Caster\CutStub;
16+
use Symfony\Component\VarDumper\Cloner\Data;
17+
use Symfony\Component\VarDumper\Cloner\Stub;
1618
use Symfony\Component\VarDumper\Cloner\VarCloner;
1719
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
1820
use Symfony\Component\VarDumper\Dumper\CliDumper;
@@ -455,4 +457,42 @@ public function testDumpArrayWithColor($value, $flags, $expectedOut)
455457

456458
$this->assertSame($expectedOut, $out);
457459
}
460+
461+
public function testCollapse()
462+
{
463+
$stub = new Stub();
464+
$stub->type = Stub::TYPE_OBJECT;
465+
$stub->class = 'stdClass';
466+
$stub->position = 1;
467+
468+
$data = new Data([
469+
[
470+
$stub,
471+
],
472+
[
473+
"\0~collapse=1\0foo" => 123,
474+
"\0+\0bar" => [1 => 2],
475+
],
476+
[
477+
'bar' => 123,
478+
]
479+
]);
480+
481+
$dumper = new CliDumper();
482+
$dump = $dumper->dump($data, true);
483+
484+
$this->assertSame(
485+
<<<'EOTXT'
486+
{
487+
foo: 123
488+
+"bar": array:1 [
489+
"bar" => 123
490+
]
491+
}
492+
493+
EOTXT
494+
,
495+
$dump
496+
);
497+
}
458498
}

0 commit comments

Comments
 (0)