|
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 |
lxs Smarty Rookie
Joined: 12 Nov 2010 Posts: 5
|
Posted: Tue Jan 08, 2013 10:20 pm Post subject: prefilter and {extends} problem with 3.1.12 |
|
|
Hi,
I am trying to upgrade from Smarty 3.0.7 to 3.1.12. I have a prefilter which rewrites the file argument to {extends}. With 3.1.12 I now get an "unmatched {block} {/block} pairs" when rendering my templates with {extends} tags in them.
As far as I can tell the reason this is happening is because while the prefiltered content is correctly passed to the lexer and parser, Smarty_Internal_Compile_Extends does a bunch of checks against the original template content. As a result the following code in smarty_internal_compile_extends.php does not behave correctly:
Code: | $_content = ($this->mbstring_overload ? mb_substr($compiler->template->source->content, $compiler->lex->counter - 1, 20000000, 'latin1') : substr($compiler->template->source->content, $compiler->lex->counter - 1)); |
Specifically $compiler->template->source->content is the original text of the template file (before prefilter) and $compiler->lex->counter is the offset into the prefiltered text just after the {extends} tag. Because my filter has made changed the length of the {extends} tag, the lexer offset isn't correct for the original (before prefilter) content. Because my prefilter happens to make the {extends} tag longer, the substr() ends up removing the first {block} tag and causes the "unmatched {block} {/block} pairs" error.
I will attempt to see if I can come up with another way to get the behavior I want which does not use prefilters, however I thought I should mention this issue.
--lxs |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jan 09, 2013 12:08 am Post subject: |
|
|
The bugfix is now in the SVN trunk and will later be included in the 3.1.13 release |
|
Back to top |
|
lxs Smarty Rookie
Joined: 12 Nov 2010 Posts: 5
|
Posted: Wed Jan 09, 2013 12:11 am Post subject: |
|
|
Good to know!
Thanks for the quick response,
--lxs |
|
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
|