Skip to content

Commit fc84f11

Browse files
committed
[VarDumper] Ignore \Error in __debugInfo()
1 parent 51cdc3a commit fc84f11

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
@@ -50,7 +50,7 @@ public static function castObject($obj, string $class, bool $hasDebugInfo = fals
5050
if ($hasDebugInfo) {
5151
try {
5252
$debugInfo = $obj->__debugInfo();
53-
} catch (\Exception $e) {
53+
} catch (\Throwable $e) {
5454
// ignore failing __debugInfo()
5555
$hasDebugInfo = false;
5656
}

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 @@ class@anonymous {
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)