Skip to content

Commit 13b873f

Browse files
[VarDumper] Fix dumping LazyObjectState when using VarExporter v8
1 parent 22560f8 commit 13b873f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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)