Code cleanup

This commit is contained in:
James Cole
2018-04-02 15:10:40 +02:00
parent fa7ab45a40
commit a3c34e6b3c
151 changed files with 802 additions and 990 deletions

View File

@@ -70,13 +70,17 @@ class Preference extends Model
}
$serialized = true;
try {
unserialize($data);
unserialize($data, ['allowed_classes' => false]);
} catch (Exception $e) {
$serialized = false;
Log::debug(sprintf('Could not unserialise preference #%d. This is good. %s', $this->id, $e->getMessage()));
}
if (!$serialized) {
$result = json_decode($data, true);
}
if ($serialized) {
Log::error(sprintf('Preference #%d ("%s") was stored as serialised object. It will be deleted and recreated.', $this->id, $this->name));
}
return $result;
}