Skip to content

Commit

Permalink
silent errors in Serializable field and allow to pass options to unse…
Browse files Browse the repository at this point in the history
…rializable function
  • Loading branch information
oscarotero committed Dec 30, 2016
1 parent a39ee3f commit fbba87b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Fields/Serializable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
*/
class Serializable extends Field
{
protected $config = [
'allowed_classes' => false
];

/**
* {@inheritdoc}
*/
Expand All @@ -20,6 +24,6 @@ public function dataToDatabase($data)
*/
public function dataFromDatabase($data)
{
return unserialize($data);
return @unserialize($data, $this->config) ?: [];
}
}

0 comments on commit fbba87b

Please sign in to comment.