From d6f43f078ca570446bace60e78f10bc789b73798 Mon Sep 17 00:00:00 2001 From: Aimeos Date: Sat, 4 Mar 2023 17:45:22 +0100 Subject: [PATCH] Allow stdClass input values for ArrayHash properties --- src/Core/Json/Hash.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Core/Json/Hash.php b/src/Core/Json/Hash.php index 97799e7..404c881 100644 --- a/src/Core/Json/Hash.php +++ b/src/Core/Json/Hash.php @@ -47,6 +47,10 @@ public static function cast($value): self $value = $value->jsonSerialize(); } + if ($value instanceof \stdClass) { + $value = (array) $value; + } + if (is_array($value) || is_null($value)) { return new self($value); }