Closed GoogleCodeExporter closed 9 years ago
How did you setup your template dir?
The setTemplateDir() and addTemplateDir() methods do sanitize trailing slashes.
Original comment by Uwe.Tews@googlemail.com
on 12 Feb 2014 at 10:55
It's relatively old project, thus property settings are used for class public
variables directly such as $smarty->template_dir = '<template_path>'. It was
originaly based on Smarty version 2.x, then upgraded to 3.0.8 - fully
functional. Now I've tried to to upgrade to version 3.1.16 but I had to switch
it back - it dit not work in many cases. Ok, we need need to refactor and
rewrite that old code, but it is easier to use older version now, stable in
these conditions.
addTemplateDir() method was used there, but setTemplateDir() not. Let me ask -
wouldn't be better to completely turn off backwards compatibility with 2.x
version and change public variables such as template_dir, compile_dir,
plugin_dir to protected ?
Original comment by david.bu...@gmail.com
on 13 Feb 2014 at 5:41
The directory variables are declared private. If you use $smarty->template_dir
= $foo;
the setter setTemplateDir is called automatically. Looking at your example it
seems that you had no trailing / but a // in the middle of the path used to
set up template_dir, right?
Original comment by Uwe.Tews@googlemail.com
on 16 Feb 2014 at 4:25
The __call() method for handling setTemplateDir() setter is implemented there -
ok, I didn't notice before, sorry for that. We're using smarty template engine
as a black box - it was working, nobody didn't care about the code inside. Yes,
you're right, what I remember, template path is composed from project dir path
(with trailing '/') + '/template/' string. I agree with you, it's not precise
at all, but it is not problem in many cases, because /path/to//somewhere is
interpreted as /path/to/somewhere. Problematic is only the template include
defined by relative path starting with '../..', that is interpreted in the way
described above (3. step reproducing the problem). Maybe somebody else has
similar problem - it's the reason why I decided to give you feedback.
Best Regards
David
Original comment by david.bu...@gmail.com
on 16 Feb 2014 at 7:48
I agree that it is a potential problem. At first I looked for a problem with a
trailing slash in in the template path and could not see where there should be
a problem. Now I see that it does popup when there is a // somewhere in the
path.
I will see that we sanitize the template_dir path in a better way.
So thanks for bringing it up.
Original comment by Uwe.Tews@googlemail.com
on 16 Feb 2014 at 6:07
The fix is now in the SVN trunk and will later be included 3.1.17
Original comment by Uwe.Tews@googlemail.com
on 16 Feb 2014 at 6:41
Original issue reported on code.google.com by
david.bu...@gmail.com
on 12 Feb 2014 at 4:32