Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / serialization / src / Normalizer / ComplexDataNormalizer.php
index e4fcf52b79ce3dfab813f98a77093f19d754b044..cd14cc014dd828a141a4f25e65b96836f822ae82 100644 (file)
@@ -34,7 +34,10 @@ class ComplexDataNormalizer extends NormalizerBase {
     // Other normalizers that extend this class may only provide $object that
     // implements \Traversable.
     if ($object instanceof ComplexDataInterface) {
-      $object = TypedDataInternalPropertiesHelper::getNonInternalProperties($object);
+      // If there are no properties to normalize, just normalize the value.
+      $object = !empty($object->getProperties(TRUE))
+        ? TypedDataInternalPropertiesHelper::getNonInternalProperties($object)
+        : $object->getValue();
     }
     /** @var \Drupal\Core\TypedData\TypedDataInterface $property */
     foreach ($object as $name => $property) {