Home » Caching » Cache_Lite » Bug #1758
warning generated
Details
| Submitted | 2004-07-01 00:29 UTC |
|---|---|
| From | djpenton at cs dot mu dot oz dot au |
| Assigned | fab |
| Status | Closed |
| Package | Cache_Lite |
| PHP Version | 4.3.4 |
| OS | Solaris |
| Roadmaps | (Not assigned) |
Comments
[2004-07-01 00:29 UTC] djpenton at cs dot mu dot oz dot au
Description:
------------
Hi,
Thanks for the package. It's very easy to use and just what I wanted.
It throws a warning when attempting to read a file that doesn't exist. It is marked with an @ to tell php you don't care (so in a sense it's a php anomoly).
Change
Line 271 Lite.php
if (@filemtime($this->_file) > $this->_refreshTime) {
To:
if (file_exists($this->_file) && @filemtime($this->_file) > $this->_refreshTime) {
Unfortunately, I have to have warnings creating big ugly error messages.
Cheers,
Dave.
Reproduce code:
---------------
$GlobalCache->save("null",$xml_file_name,"null");
if ($data=$GlobalCache->get($xml_file_name, "tree"))
{
//Goodo
$tree=unserialise($data);
}
else
{
$tree = new XML_Tree($xml_file_name);
$tree->getTreeFromFile();
$tree->get();
$GlobalCache->save(serialise($tree),$xml_file_name, "tree");
}
Expected result:
----------------
$tree with no warning
Actual result:
--------------
$tree with warning
[2004-07-12 23:54 UTC] djpenton at cs dot mu dot oz dot au
I suspect performance will be close to identical. The worst case will cause it to take an extra 1/500 of a second. There is a note on the php page:
flobee at gmx dot net
23-Jun-2004 03:05
yust a little note: some people told me that they dont use this function because of taking too much performance/time:
well, they are right in some ways: if you expect a file this function runs perferct. if it don“t find a file it takes really long:
benchmark in a for() statment
500 circles
using file_exists() to be TRUE : 0.00378203392029
using file_exists() to be FALSE: 0.951257944107