From 7fb3165ab833e2a06f10828c355c239e587328f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=BCrkalp=20Burak=20KAYRANCIO=C4=9ELU?= Date: Sat, 24 Nov 2018 23:49:09 +0300 Subject: [PATCH] Update NetworkSettingsNormalizer.php --- src/Normalizer/NetworkSettingsNormalizer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php index 6d82a9e6..55b517b2 100644 --- a/src/Normalizer/NetworkSettingsNormalizer.php +++ b/src/Normalizer/NetworkSettingsNormalizer.php @@ -57,8 +57,12 @@ public function denormalize($data, $class, $format = null, array $context = []) $values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS); foreach ($data->{'Ports'} as $key => $value) { $values_1 = []; - foreach ($value as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context); + if (is_iterable($value)){ + foreach ($value as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context); + } + } else { + $values_1[] = $this->denormalizer->denormalize(null, 'Docker\\API\\Model\\PortBinding', 'json', $context); } $values[$key] = $values_1; }