|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
jboffel Smarty n00b
Joined: 06 Oct 2013 Posts: 1
|
Posted: Sun Oct 06, 2013 11:12 pm Post subject: Bug in smarty_internal_compile_include.php >=Smarty 3.1.8 |
|
|
Hi,
I'd like to report what I think is a bug in smarty_internal_compile_include.php.
if you reproduce a structure like this :
* ./smartybug.tpl {include ./static.tpl},{include ./test/test.tpl}
* ./static.tpl {1}
* ./test/test.tpl {include ./static.tpl}
* ./test/static.tpl {2}
When you render it :
Before fix it will show : 11
After fix : 12
Basically, I'd say in some configuration, include function of smarty working in relative path will fail to make a unique identifier for each template file because it will use only the relative ressource file as an identifier for the function list of subtemplates in the merged file.
I made a patch that seems to work. However, there are probably better approach to fix it. I give it here whatever to give a guess on how to solve the problem. I just make sure we only work in full path.
Before
Code: |
$include_file = $_attr['file'];
if (isset($_attr['assign'])) {
// output will be stored in a smarty variable instead of beind displayed
$_assign = $_attr['assign'];
}
|
After
Code: |
$include_file = $_attr['file'];
if ($include_file[1] == '.') {
$include_file = '"' . str_replace('\\', '\\\\', realpath(dirname($compiler->smarty->_current_file) . '/' . trim($include_file, '"'))) . '"';
}
if (isset($_attr['assign'])) {
// output will be stored in a smarty variable instead of beind displayed
$_assign = $_attr['assign'];
}
|
The str_replace is just protecting \ for windows path. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Oct 13, 2013 5:55 pm Post subject: |
|
|
The fix is now in the SVN trunk and will later be included in 3.1.16
NOTE: If you use ambiguous relative file name you must also set
$smarty->allow_ambiguous_resources = true;
For some reason this flag is not in documentation. I will add it ASAP |
|
Back to top |
|
KarenAnderson Smarty n00b
Joined: 15 Nov 2013 Posts: 1
|
Posted: Fri Nov 15, 2013 7:04 am Post subject: |
|
|
Hey hi..
I am finding some difficulties in detecting bugs...can I use Apache Tomcat or
Google apps email signature code.. |
|
Back to top |
|
|
|
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
|