Skip to content

Commit 3f912bf

Browse files
bug symfony#60724 [VarDumper] Fix dumping LazyObjectState when using VarExporter v8 (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [VarDumper] Fix dumping LazyObjectState when using VarExporter v8 | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- 56554c2 [VarDumper] Fix dumping LazyObjectState when using VarExporter v8
2 parents 6156095 + 56554c2 commit 3f912bf

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Symfony/Component/VarDumper/Caster/SymfonyCaster.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ public static function castLazyObjectState($state, array $a, Stub $stub, bool $i
9090

9191
$instance = $a['realInstance'] ?? null;
9292

93-
$a = ['status' => new ConstStub(match ($a['status']) {
94-
LazyObjectState::STATUS_INITIALIZED_FULL => 'INITIALIZED_FULL',
95-
LazyObjectState::STATUS_INITIALIZED_PARTIAL => 'INITIALIZED_PARTIAL',
96-
LazyObjectState::STATUS_UNINITIALIZED_FULL => 'UNINITIALIZED_FULL',
97-
LazyObjectState::STATUS_UNINITIALIZED_PARTIAL => 'UNINITIALIZED_PARTIAL',
98-
}, $a['status'])];
93+
if (isset($a['status'])) { // forward-compat with Symfony 8
94+
$a = ['status' => new ConstStub(match ($a['status']) {
95+
LazyObjectState::STATUS_INITIALIZED_FULL => 'INITIALIZED_FULL',
96+
LazyObjectState::STATUS_INITIALIZED_PARTIAL => 'INITIALIZED_PARTIAL',
97+
LazyObjectState::STATUS_UNINITIALIZED_FULL => 'UNINITIALIZED_FULL',
98+
LazyObjectState::STATUS_UNINITIALIZED_PARTIAL => 'UNINITIALIZED_PARTIAL',
99+
}, $a['status'])];
100+
}
99101

100102
if ($instance) {
101103
$a['realInstance'] = $instance;

0 commit comments

Comments
 (0)