Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e85acdd

Browse filesBrowse 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
Copy full SHA for e85acdd

File tree

1 file changed

+10
-1
lines changed
Filter options

1 file changed

+10
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/Caster.php
+10-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.