From 8fe54794d82d4017da0509d4e940a019f53bbdfc Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 16 Jan 2024 17:34:27 +0000 Subject: [PATCH] [core] consider a dynamic prop to exist if it is defined, even without a value --- core/imageboard/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/imageboard/image.php b/core/imageboard/image.php index f72b6918..92c5afec 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -116,14 +116,14 @@ class Image implements \ArrayAccess public function offsetExists(mixed $offset): bool { - return array_key_exists($offset, $this->dynamic_props); + return array_key_exists($offset, static::$prop_types); } public function offsetGet(mixed $offset): mixed { if(!$this->offsetExists($offset)) { throw new \OutOfBoundsException("Undefined dynamic property: $offset"); } - return $this->dynamic_props[$offset]; + return $this->dynamic_props[$offset] ?? null; } public function offsetSet(mixed $offset, mixed $value): void {