Skip to content

Commit adb59da

Browse files
committed
Fix props dump cache
1 parent f18f87f commit adb59da

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/utilities/src/functions.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ function get_object_dump_props(
516516
?int $filter = null,
517517
?array &$ignores = []
518518
): array {
519+
/** @var array[] $cache */
519520
static $cache = [];
520521
$isObject = is_object($object);
521522
$key = ($isObject ? get_class($object) : $object) . '|' . $filter;
@@ -535,11 +536,6 @@ function get_object_dump_props(
535536
foreach ($props as $prop) {
536537
$name = $prop->getName();
537538

538-
if ($isObject && !$prop->isInitialized($object)) {
539-
$ignores[$prop->getName()] = $prop;
540-
continue;
541-
}
542-
543539
if ($prop->isProtected() || $prop->isPrivate() || $prop->isVirtual()) {
544540
if (
545541
!($filter & \ReflectionProperty::IS_VIRTUAL)
@@ -569,6 +565,7 @@ function get_object_dump_values(
569565
object $object,
570566
?int $filter = null
571567
): array {
568+
/** @var array[] $cache */
572569
static $cache = [];
573570
$cacheKey = $object::class . '|' . ($filter ?? 'all');
574571

@@ -592,6 +589,10 @@ function get_object_dump_values(
592589
continue;
593590
}
594591

592+
if (!$prop->isInitialized($object)) {
593+
continue;
594+
}
595+
595596
$vars[$name] = $prop->getValue($object);
596597
}
597598

0 commit comments

Comments
 (0)