|
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 |
neteor Smarty n00b
Joined: 31 Aug 2012 Posts: 1
|
Posted: Wed Jun 01, 2016 9:46 am Post subject: Found a bug in smarty_internal_templatelexer.php |
|
|
Hi there,
first I apologize for my poor english...
hope that someone will read my report.
We work with Smarty for more than 10 years, so we're not expert like Smarty's devs but have a good know about this framework.
We found a bug in smarty_internal_templatelexer.php
When using a specific "$smarty->left_delimiter" and "$smarty->right_delimiter", the templatelexer does not "preg_quote" this two properties correctly.
Solution found in smarty_internal_templatelexer.php
Line 213:
replace "$this->ldel = preg_quote($this->smarty->left_delimiter, '~');"
by "$this->ldel = preg_quote($this->smarty->left_delimiter, '/');"
and line 217:
replace "$this->rdel = preg_quote($this->smarty->right_delimiter, '~');"
by "$this->rdel = preg_quote($this->smarty->right_delimiter, '/');
This bug has been found in goal of generate some RTF and DOCS documents. To his feature, we write Words documents with specific <FUSION>$VARIABLE</FUSION> smarty syntax.
Reproduce the bug:
<?php
$smarty = new Smarty();
$smarty->left_delimiter = '<FUSION>';
$smarty->right_delimiter = '</FUSION>';
$templatecode = '<FUSION>{$smarty.date}</FUSION>{\and more code....}';
$smarty->fetch('string:' . $templatecode);
will display ==> "Result: Unexpected input at line 1 : <"
Smarty Version: 3.1.29 |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Jun 01, 2016 4:22 pm Post subject: |
|
|
I doubt this is the right fix for the issue.
preg_quote does what it does.
Why Smarty chokes on the result is unrelated to the fix presented. |
|
Back to top |
|
a.shpota Smarty n00b
Joined: 03 Jun 2016 Posts: 3
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Sep 15, 2016 5:11 am Post subject: |
|
|
This was fixed in 3.1.30 |
|
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
|