fix(session): initialize data lazily in save() to prevent uninitialized property access (#252)

This commit is contained in:
Antoine Bluchet 2026-03-05 00:07:49 +01:00 • committed by GitHub
commit 61c20f1450
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -51,7 +51,7 @@ class Session implements SessionInterface
public function save(): bool
{
return $this->store->write($this->id, json_encode($this->data, \JSON_THROW_ON_ERROR));
return $this->store->write($this->id, json_encode($this->readData(), \JSON_THROW_ON_ERROR));
}
public function get(string $key, mixed $default = null): mixed