Skip to content
Extraits de code Groupes Projets
Valider 3c29271c rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

throw exception in case someone wants to cache an object

parent 1c805ec4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -128,6 +128,10 @@ class CacheFile ...@@ -128,6 +128,10 @@ class CacheFile
$id = $this->cachePath . $id . '.php'; $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 = "<" . "?php\n";
$cache_literal .= "$" . "content = " . var_export($content, true) . ";\n"; $cache_literal .= "$" . "content = " . var_export($content, true) . ";\n";
$cache_literal .= "$" . "expires_on = " . $this->getExpiresTime() . ";\n"; $cache_literal .= "$" . "expires_on = " . $this->getExpiresTime() . ";\n";
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter