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
-------
eb2eb76d0e
[VarDumper] ignore failing __debugInfo()
This commit is contained in:
commit
e85acddc9a
@ -54,6 +54,15 @@ class Caster
|
|||||||
$class = $class->name;
|
$class = $class->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($hasDebugInfo) {
|
||||||
|
try {
|
||||||
|
$debugInfo = $obj->__debugInfo();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// ignore failing __debugInfo()
|
||||||
|
$hasDebugInfo = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$a = $obj instanceof \Closure ? [] : (array) $obj;
|
$a = $obj instanceof \Closure ? [] : (array) $obj;
|
||||||
|
|
||||||
if ($obj instanceof \__PHP_Incomplete_Class) {
|
if ($obj instanceof \__PHP_Incomplete_Class) {
|
||||||
@ -89,7 +98,7 @@ class Caster
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hasDebugInfo && \is_array($debugInfo = $obj->__debugInfo())) {
|
if ($hasDebugInfo && \is_array($debugInfo)) {
|
||||||
foreach ($debugInfo as $k => $v) {
|
foreach ($debugInfo as $k => $v) {
|
||||||
if (!isset($k[0]) || "\0" !== $k[0]) {
|
if (!isset($k[0]) || "\0" !== $k[0]) {
|
||||||
$k = self::PREFIX_VIRTUAL.$k;
|
$k = self::PREFIX_VIRTUAL.$k;
|
||||||
|
Reference in New Issue
Block a user