Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Bug in _get_auto_filename?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
JornLind
Smarty n00b


Joined: 16 Oct 2003
Posts: 1

PostPosted: Mon Oct 25, 2004 9:25 pm    Post subject: Bug in _get_auto_filename? Reply with quote

The function _get_auto_filename() reads:

Code:
    function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null)
    {
        $_compile_dir_sep =  $this->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
        $_return = $auto_base . DIRECTORY_SEPARATOR;

        if(isset($auto_id)) {
            // make auto_id safe for directory names
            $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id)));
            // split into separate directories
            $_return .= $auto_id . $_compile_dir_sep;  // BUG???
        }
...


Look where I added "// BUG??".

Just before that the $_compile_dir_sep is added $auto_id. Then we add both $auto_id and $_compile_dir_sep again to $_return.

If not using subdirs, as in my case, we get a return value of "basedir/...^^" - where I would expect "basedir/...^".

The problem then arises when trying to clear all files belonging to a cache id - for instance "news|5".

In this case the cache files are named "basedir/news^5^...html".

The return value of the function is although "basedir/news^^" which is used to match against the filenames in cache_all_clear(). The match always fails due to the double-hat ^^.

I may very well be wrong on something here, sorry for that, but my point is - there might just be a hat ^ too many in the above function.

Otherwise - thanks for a very usefull tool!
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Oct 25, 2004 10:06 pm    Post subject: Reply with quote

to me it seems you are passing '' to _get_auto_filename() where you want to pass null.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP