From e2e20b7294e45e40ce533c063dd6541e18f49f8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Fri, 22 Jun 2018 16:12:16 +0200 Subject: [PATCH] Fix invalid object types are handled with additionalData These objects can contain an additionalData value which is NULL. This leads to an error with the strict data types, since unserialize expects a string. See #2534 --- wcfsetup/install/files/lib/data/box/Box.class.php | 2 +- .../files/lib/data/user/notification/UserNotification.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/data/box/Box.class.php b/wcfsetup/install/files/lib/data/box/Box.class.php index 87fda493e8..35732b44c4 100644 --- a/wcfsetup/install/files/lib/data/box/Box.class.php +++ b/wcfsetup/install/files/lib/data/box/Box.class.php @@ -144,7 +144,7 @@ class Box extends DatabaseObject { // handle condition data if ($data['additionalData'] !== null) { - $this->data['additionalData'] = @unserialize($data['additionalData']); + $this->data['additionalData'] = @unserialize($data['additionalData'] ?: ''); } if (!is_array($this->data['additionalData'])) { $this->data['additionalData'] = []; diff --git a/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php b/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php index ddcabf732f..34247b45c8 100644 --- a/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php +++ b/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php @@ -48,7 +48,7 @@ class UserNotification extends DatabaseObject { protected function handleData($data) { parent::handleData($data); - $this->data['additionalData'] = @unserialize($this->data['additionalData']); + $this->data['additionalData'] = @unserialize($this->data['additionalData'] ?: ''); if (!is_array($this->data['additionalData'])) { $this->data['additionalData'] = []; } -- 2.20.1