Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

Fix Invalid argument foreach #2

Open
wants to merge 2 commits into
base: 4.1.36
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Normalizer/NetworkSettingsNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ 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($value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use if(is_iterable($value))?

{
foreach ($value as $value_1) {
$values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context);
}
}
$values[$key] = $values_1;
}
Expand Down