From 0bf1dfe9c2dd11b6d5d1fadf73378294ca7487b3 Mon Sep 17 00:00:00 2001 From: Rodrigo Aguilera Date: Tue, 15 Oct 2024 19:45:02 +0200 Subject: [PATCH 1/2] Fix #16: Patches not applied in latest version. --- patches/NetworkSettingsNormalizer.patch | 77 ++++++++++++++------ src/Normalizer/NetworkSettingsNormalizer.php | 8 ++ 2 files changed, 62 insertions(+), 23 deletions(-) diff --git a/patches/NetworkSettingsNormalizer.patch b/patches/NetworkSettingsNormalizer.patch index 509cd29f..c444acdd 100644 --- a/patches/NetworkSettingsNormalizer.patch +++ b/patches/NetworkSettingsNormalizer.patch @@ -1,26 +1,57 @@ +diff --git a/patches/NetworkSettingsNormalizer.patch b/patches/NetworkSettingsNormalizer.patch +index 509cd29..e69de29 100644 +--- a/patches/NetworkSettingsNormalizer.patch ++++ b/patches/NetworkSettingsNormalizer.patch +@@ -1,26 +0,0 @@ +-diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php +-index dc48cc5..a3cb884 100644 +---- a/src/Normalizer/NetworkSettingsNormalizer.php +-+++ b/src/Normalizer/NetworkSettingsNormalizer.php +-@@ -79,6 +79,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte +- if (\array_key_exists('Ports', $data) && $data['Ports'] !== null) { +- $values = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS); +- foreach ($data['Ports'] as $key => $value) { +-+ if ($value === null) { +-+ $values[$key] = null; +-+ continue; +-+ } +- $values_1 = array(); +- foreach ($value as $value_1) { +- $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context); +-@@ -218,6 +222,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte +- if ($object->isInitialized('ports') && null !== $object->getPorts()) { +- $values = array(); +- foreach ($object->getPorts() as $key => $value) { +-+ if ($value === null) { +-+ $values[$key] = null; +-+ continue; +-+ } +- $values_1 = array(); +- foreach ($value as $value_1) { +- $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php -index dc48cc5..a3cb884 100644 +index 0c73d7f..a3c893a 100644 --- a/src/Normalizer/NetworkSettingsNormalizer.php +++ b/src/Normalizer/NetworkSettingsNormalizer.php -@@ -79,6 +79,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte - if (\array_key_exists('Ports', $data) && $data['Ports'] !== null) { - $values = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS); - foreach ($data['Ports'] as $key => $value) { -+ if ($value === null) { -+ $values[$key] = null; -+ continue; -+ } - $values_1 = array(); - foreach ($value as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context); -@@ -218,6 +222,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte - if ($object->isInitialized('ports') && null !== $object->getPorts()) { - $values = array(); - foreach ($object->getPorts() as $key => $value) { -+ if ($value === null) { -+ $values[$key] = null; -+ continue; -+ } - $values_1 = array(); - foreach ($value as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); +@@ -78,6 +78,10 @@ if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR + if (\array_key_exists('Ports', $data) && null !== $data['Ports']) { + $values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS); + foreach ($data['Ports'] as $key => $value) { ++ if ($value === null) { ++ $values[$key] = null; ++ continue; ++ } + $values_1 = []; + foreach ($value as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context); +@@ -203,6 +207,10 @@ if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR + if ($object->isInitialized('ports') && null !== $object->getPorts()) { + $values = []; + foreach ($object->getPorts() as $key => $value) { ++ if ($value === null) { ++ $values[$key] = null; ++ continue; ++ } + $values_1 = []; + foreach ($value as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php index 0c73d7f3..a3c893a0 100644 --- a/src/Normalizer/NetworkSettingsNormalizer.php +++ b/src/Normalizer/NetworkSettingsNormalizer.php @@ -78,6 +78,10 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a if (\array_key_exists('Ports', $data) && null !== $data['Ports']) { $values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS); foreach ($data['Ports'] as $key => $value) { + if ($value === null) { + $values[$key] = null; + continue; + } $values_1 = []; foreach ($value as $value_1) { $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context); @@ -203,6 +207,10 @@ public function normalize(mixed $object, ?string $format = null, array $context if ($object->isInitialized('ports') && null !== $object->getPorts()) { $values = []; foreach ($object->getPorts() as $key => $value) { + if ($value === null) { + $values[$key] = null; + continue; + } $values_1 = []; foreach ($value as $value_1) { $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); From 36d5e7f0eb3a85bc097b489524750e7caa513c92 Mon Sep 17 00:00:00 2001 From: Rodrigo Aguilera Date: Tue, 15 Oct 2024 19:49:49 +0200 Subject: [PATCH 2/2] Fix patch. --- patches/NetworkSettingsNormalizer.patch | 31 ------------------------- 1 file changed, 31 deletions(-) diff --git a/patches/NetworkSettingsNormalizer.patch b/patches/NetworkSettingsNormalizer.patch index c444acdd..81821033 100644 --- a/patches/NetworkSettingsNormalizer.patch +++ b/patches/NetworkSettingsNormalizer.patch @@ -1,34 +1,3 @@ -diff --git a/patches/NetworkSettingsNormalizer.patch b/patches/NetworkSettingsNormalizer.patch -index 509cd29..e69de29 100644 ---- a/patches/NetworkSettingsNormalizer.patch -+++ b/patches/NetworkSettingsNormalizer.patch -@@ -1,26 +0,0 @@ --diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php --index dc48cc5..a3cb884 100644 ----- a/src/Normalizer/NetworkSettingsNormalizer.php --+++ b/src/Normalizer/NetworkSettingsNormalizer.php --@@ -79,6 +79,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte -- if (\array_key_exists('Ports', $data) && $data['Ports'] !== null) { -- $values = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS); -- foreach ($data['Ports'] as $key => $value) { --+ if ($value === null) { --+ $values[$key] = null; --+ continue; --+ } -- $values_1 = array(); -- foreach ($value as $value_1) { -- $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context); --@@ -218,6 +222,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte -- if ($object->isInitialized('ports') && null !== $object->getPorts()) { -- $values = array(); -- foreach ($object->getPorts() as $key => $value) { --+ if ($value === null) { --+ $values[$key] = null; --+ continue; --+ } -- $values_1 = array(); -- foreach ($value as $value_1) { -- $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php index 0c73d7f..a3c893a 100644 --- a/src/Normalizer/NetworkSettingsNormalizer.php