From 2372395da1731d27f0c75036c5fb44fa92574fca Mon Sep 17 00:00:00 2001 From: Beau Simensen Date: Tue, 6 Jun 2023 11:44:44 -0500 Subject: [PATCH] Do not try to pass parameters that are not defined --- src/Serialization/EdgeAwareReflectionSerializing.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Serialization/EdgeAwareReflectionSerializing.php b/src/Serialization/EdgeAwareReflectionSerializing.php index 7d961e9..e288a33 100644 --- a/src/Serialization/EdgeAwareReflectionSerializing.php +++ b/src/Serialization/EdgeAwareReflectionSerializing.php @@ -94,7 +94,9 @@ public static function fromPayload(array $payload): static } } - $args[$constructorKey] = $payload[$key]; + if (array_key_exists($key, $payload)) { + $args[$constructorKey] = $payload[$key]; + } } return $class->newInstance(...$args);