8000 [VarDumper] Ignore \Error in __debugInfo() · symfony/symfony@cc5ab14 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc5ab14

Browse files
committed
[VarDumper] Ignore \Error in __debugInfo()
1 parent 8ad45c7 commit cc5ab14

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function castObject(object $obj, string $class, bool $hasDebugInfo
4747
if ($hasDebugInfo) {
4848
try {
4949
$debugInfo = $obj->__debugInfo();
50-
} catch (\Exception $e) {
50+
} catch (\Throwable $e) {
5151
// ignore failing __debugInfo()
5252
$hasDebugInfo = false;
5353
}

src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,14 @@ public function testAnonymousClass()
175175
, $c
176176
);
177177
}
178+
179+
public function testTypeErrorInDebugInfo()
180+
{
181+
$this->assertDumpMatchesFormat('class@anonymous {}', new class() {
182+
public function __debugInfo(): array
183+
{
184+
return ['class' => \get_class(null)];
185+
}
186+
});
187+
}
178188
}

0 commit comments

Comments
 (0)
0