Skip to content

Commit 555e562

Browse files
committed
Fix UploadableNormalizer when string IRI may be passed instead of data
1 parent 6522b01 commit 555e562

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/Serializer/Normalizer/UploadableNormalizer.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,7 @@ public function supportsDenormalization($data, $type, $format = null, array $con
6565
return !isset($context[self::ALREADY_CALLED]) && $this->annotationReader->isConfigured($type);
6666
}
6767

68-
/**
69-
* {@inheritdoc}
70-
*/
71-
public function denormalize($data, $type, $format = null, array $context = []): mixed
72-
{
73-
$context[self::ALREADY_CALLED] = true;
74-
68+
private function findConfiguredFields(iterable $data, string $type): iterable {
7569
foreach ($data as $fieldName => $value) {
7670
try {
7771
$reflectionProperty = new \ReflectionProperty($type, $fieldName);
@@ -101,6 +95,20 @@ public function denormalize($data, $type, $format = null, array $context = []):
10195
}
10296
}
10397

98+
return $data;
99+
}
100+
101+
/**
102+
* {@inheritdoc}
103+
*/
104+
public function denormalize($data, $type, $format = null, array $context = []): mixed
105+
{
106+
$context[self::ALREADY_CALLED] = true;
107+
108+
if (is_iterable($data)) {
109+
$this->findConfiguredFields($data, $type);
110+
}
111+
104112
return $this->denormalizer->denormalize($data, $type, $format, $context);
105113
}
106114

0 commit comments

Comments
 (0)