cachefile : check the parameter before use them
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5811 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -157,6 +157,9 @@ class cachefile
|
|||||||
throw new \Exception ("CacheFile TTL invalid : not integer or negative".
|
throw new \Exception ("CacheFile TTL invalid : not integer or negative".
|
||||||
" : '$ttl'",
|
" : '$ttl'",
|
||||||
500);
|
500);
|
||||||
|
if (! is_string ($id) || ! is_integer ($id))
|
||||||
|
throw new \Exception ("CacheFile write ID not a string : ".gettype ($id),
|
||||||
|
500);
|
||||||
|
|
||||||
$this->garbage ();
|
$this->garbage ();
|
||||||
$fileCache = $this->directory."/".sha1 ($id);
|
$fileCache = $this->directory."/".sha1 ($id);
|
||||||
@@ -192,6 +195,9 @@ class cachefile
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->garbage ();
|
$this->garbage ();
|
||||||
|
if (! is_string ($id) || ! is_integer ($id))
|
||||||
|
throw new \Exception ("CacheFile read ID not a string : ".gettype ($id),
|
||||||
|
500);
|
||||||
$fileCache = $this->directory."/".sha1 ($id);
|
$fileCache = $this->directory."/".sha1 ($id);
|
||||||
if (!file_exists ($fileCache))
|
if (!file_exists ($fileCache))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user