[core] consider a dynamic prop to exist if it is defined, even without a value

This commit is contained in:
Shish 2024-01-16 17:34:27 +00:00
parent d999198fb6
commit 8fe54794d8

View file

@ -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
{