Skip to content

Commit be330f9

Browse files
Merge branch '4.3' into 4.4
* 4.3: use utf8mb4_bin to align code with documentation [HttpClient] make pushed responses retry-able [VarDumper] ignore failing __debugInfo()
2 parents 69c7bcd + 79f8d0b commit be330f9

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
@@ -47,6 +47,15 @@ class Caster
4747
*/
4848
public static function castObject($obj, string $class, bool $hasDebugInfo = false): array
4949
{
50+
if ($hasDebugInfo) {
51+
try {
52+
$debugInfo = $obj->__debugInfo();
53+
} catch (\Exception $e) {
54+
// ignore failing __debugInfo()
55+
$hasDebugInfo = false;
56+
}
57+
}
58+
5059
$a = $obj instanceof \Closure ? [] : (array) $obj;
5160

5261
if ($obj instanceof \__PHP_Incomplete_Class) {
@@ -82,7 +91,7 @@ public static function castObject($obj, string $class, bool $hasDebugInfo = fals
8291
}
8392
}
8493

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

0 commit comments

Comments
 (0)