Re: [SMARTY] BUG? can't delete cache directorys with the name "0"
| From: | Monte Ohrt | Date: | Tue, 14 Jan 2003 17:40:48 +0000 |
| Subject: | Re: [SMARTY] BUG? can't delete cache directorys with the name "0" | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7179@lists.php.net to get a copy of this message | ||
good catch, it will get put into next commit.
Monte
On Tue, 2003-01-14 at 04:32, Frank Bauer wrote:
> 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.
--
Monte Ohrt <monte@ispi.net>