Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 1fec387a4317 |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php Thu Apr 26 11:26:54 2018 +0100 +++ b/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php Tue Jul 10 15:07:59 2018 +0100 @@ -255,6 +255,12 @@ $builtinType = Type::BUILTIN_TYPE_OBJECT; $class = $collectionValueType->getClassName().'[]'; + // Fix a collection that contains the only one element + // This is special to xml format only + if ('xml' === $format && !is_int(key($data))) { + $data = array($data); + } + if (null !== $collectionKeyType = $type->getCollectionKeyType()) { $context['key_type'] = $collectionKeyType; } @@ -301,7 +307,6 @@ /** * Sets an attribute and apply the name converter if necessary. * - * @param array $data * @param string $attribute * @param mixed $attributeValue * @@ -332,6 +337,7 @@ { if ( !isset($context[static::ENABLE_MAX_DEPTH]) || + !$context[static::ENABLE_MAX_DEPTH] || !isset($attributesMetadata[$attribute]) || null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth() ) {