8000 bug #35010 [VarDumper] ignore failing __debugInfo() (nicolas-grekas) · symfony/symfony@e85acdd · GitHub
[go: up one dir, main page]

Skip to content

Commit e85acdd

Browse files
bug #35010 [VarDumper] ignore failing __debugInfo() (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [VarDumper] ignore failing __debugInfo() | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34993 | License | MIT | Doc PR | - Commits ------- eb2eb76 [VarDumper] ignore failing __debugInfo()
2 parents b47f1af + eb2eb76 commit e85acdd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ public static function castObject($obj, $class, $hasDebugInfo = false)
5454
$class = $class->name;
5555
}
5656

57+
if ($hasDebugInfo) {
58+
try {
59+
$debugInfo = $obj->__debugInfo();
60+
} catch (\Exception $e) {
61+
// ignore failing __debugInfo()
62+
$hasDebugInfo = false;
63+
}
64+
}
65+
5766
$a = $obj instanceof \Closure ? [] : (array) $obj;
5867

5968
if ($obj instanceof \__PHP_Incomplete_Class) {
@@ -89,7 +98,7 @@ public static function castObject($obj, $class, $hasDebugInfo = false)
8998
}
9099
}
91100

92-
if ($hasDebugInfo && \is_array($debugInfo = $obj->__debugInfo())) {
101+
if ($hasDebugInfo && \is_array($debugInfo)) {
93102
foreach ($debugInfo as $k => $v) {
94103
if (!isset($k[0]) || "\0" !== $k[0]) {
95104
$k = self::PREFIX_VIRTUAL.$k;

0 commit comments

Comments
 (0)
0