Skip to content

Commit 79f8d0b

Browse files
Merge branch '3.4' into 4.3
* 3.4: use utf8mb4_bin to align code with documentation [VarDumper] ignore failing __debugInfo()
2 parents 1ba23c8 + 1090752 commit 79f8d0b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Caster/Caster.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ class Caster
4848
*/
4949
public static function castObject($obj, $class, $hasDebugInfo = false)
5050
{
51+
if ($hasDebugInfo) {
52+
try {
53+
$debugInfo = $obj->__debugInfo();
54+
} catch (\Exception $e) {
55+
// ignore failing __debugInfo()
56+
$hasDebugInfo = false;
57+
}
58+
}
59+
5160
$a = $obj instanceof \Closure ? [] : (array) $obj;
5261

5362
if ($obj instanceof \__PHP_Incomplete_Class) {
@@ -83,7 +92,7 @@ public static function castObject($obj, $class, $hasDebugInfo = false)
8392
}
8493
}
8594

86-
if ($hasDebugInfo && \is_array($debugInfo = $obj->__debugInfo())) {
95+
if ($hasDebugInfo && \is_array($debugInfo)) {
8796
foreach ($debugInfo as $k => $v) {
8897
if (!isset($k[0]) || "\0" !== $k[0]) {
8998
$k = self::PREFIX_VIRTUAL.$k;

0 commit comments

Comments
 (0)