Skip to content

Commit

Permalink
Serialize all content and remove error suppression (fixes #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hall committed Dec 4, 2018
1 parent 46db7c7 commit bffc067
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/DOFileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ public function set($key, $content, $expiry = 0)
{
$cacheObj = new \stdClass();

if (!is_string($content)) {
$content = serialize($content);
}

$cacheObj->content = $content;
$cacheObj->content = serialize($content);

if (!$expiry) {
// If no expiry specified, set to 'Never' expire timestamp (+10 years)
Expand Down Expand Up @@ -133,7 +129,7 @@ public function get($key)
// Cache item has not yet expired or system load is too high
$content = $cacheObj->content;

if (($unserializedContent = @unserialize($content)) !== false) {
if (($unserializedContent = unserialize($content)) !== false) {
// Normal unserialization
$content = $unserializedContent;
} elseif ($content == serialize(false)) {
Expand Down

0 comments on commit bffc067

Please sign in to comment.