Skip to content

Commit

Permalink
throw exception in case someone wants to cache an object
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Sep 23, 2013
1 parent 1c805ec commit 3c29271
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/CacheFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ public function set($id, $content)

$id = $this->cachePath . $id . '.php';

if (is_object($content)) {
throw new \Exception('You cannot use the CacheFile to cache an object, only arrays, strings and numbers.');
}

$cache_literal = "<" . "?php\n";
$cache_literal .= "$" . "content = " . var_export($content, true) . ";\n";
$cache_literal .= "$" . "expires_on = " . $this->getExpiresTime() . ";\n";
Expand Down

0 comments on commit 3c29271

Please sign in to comment.