From 03d0260347d039cc05e078ff36873b7dfeeb1e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Guti=C3=A9rrez?= Date: Thu, 6 Jun 2019 02:27:39 +0200 Subject: [PATCH] check immutability on unserialize --- composer.json | 2 +- src/AbstractIdentity.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 4e1b0cf..1bd7283 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "require": { "php": "^7.1", "ext-json": "*", - "phpgears/immutability": "~0.1", + "phpgears/immutability": "~0.1.5", "ramsey/uuid": "^3.7" }, "require-dev": { diff --git a/src/AbstractIdentity.php b/src/AbstractIdentity.php index 1b76576..9950ade 100644 --- a/src/AbstractIdentity.php +++ b/src/AbstractIdentity.php @@ -82,8 +82,9 @@ final public function serialize(): string */ final public function unserialize($serialized): void { - $this->value = \unserialize($serialized, [static::class]); - $this->alreadyConstructed = true; + $this->checkImmutability(); + + $this->value = \unserialize($serialized, ['allowed_classes' => false]); } /**