Skip to content

Commit 78321c9

Browse files
committed
fix(mapper): check property initialization before access
1 parent 3af8cd1 commit 78321c9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/mapper/src/Mappers/ObjectToArrayMapper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public function map(mixed $from, mixed $to): mixed
4949

5050
private function resolvePropertyValue(PropertyReflector $property, object $object): mixed
5151
{
52+
if (!$property->isInitialized($object)) {
53+
return null;
54+
}
55+
5256
$propertyValue = $property->getValue($object);
5357

5458
if ($property->getIterableType()?->isClass()) {

0 commit comments

Comments
 (0)