BUG? can't delete cache directorys with the name "0"
| From: | Frank Bauer | Date: | Tue, 14 Jan 2003 10:32:15 +0000 |
| Subject: | BUG? can't delete cache directorys with the name "0" | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7177@lists.php.net to get a copy of this message | ||
Hi there,
I made a cache-group and cache files by using numbers ("0", "1", ...).
Now, when I want to delete those files in that group by using
clear_cach(xxx), nothing happens, they will not be deleted.
However, if I name the cachesfiles differently, eg "_0", "_1" everything
is working fine.
So I thought there might be a problem with using "0" as a name.
I was now looking up Smarty.class.php and found in
function _rmdir($dirname, $level = 1, $exp_time = null):
while ($entry = readdir($handle)) { ...
So, if readdir() returns "0" it will be treated as kind of "FALSE"
and the deletion iteration will stop there.
Wouldn't it be more hassle free to code:
while ( NULL!=($entry = readdir($handle))) {
That works fine for me!
Could we consider that a bug. If yes, who could make that change?
regards
Frank
PS: I'm using smarty 2.3.0, though the code is still the same for 2.3.1 I think.