|
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 |
djn Smarty Rookie
Joined: 15 Nov 2004 Posts: 13 Location: Trst
|
Posted: Sun Mar 16, 2014 5:03 pm Post subject: Warning on auto_literal and mbstring.func_overload |
|
|
Hello all.
I'm getting a repeated warning in Smarty 3.1.17/PHP 5.3.15. This only happens if $smarty->auto_literal is set to true and mbsting.func_overload is either 2, 6 or 7. The warning says:
Code: | Warning: mb_strpos(): Empty delimiter in (omitted...)\smarty\sysplugins\smarty_internal_templatelexer.php on line 316 |
This is the complete function (starts on line 313):
Code: | function yy_r1_13($yy_subpatterns)
{
if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length - 1,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length - 1,1)) !== false))) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else {
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yypushstate(self::SMARTY);
$this->taglineno = $this->line;
}
} |
Other mbstring settings, if needed to replicate:
mbstring.internal_encoding = UTF-8
mbstring.http_output = UTF-8
mbstring.encoding_translation = On
At line 316 of smarty_internal_templatelexer.php I see that mb_substr($this->value,$this->ldel_length,1,'latin1')) evaluates to false, $this->value is '{' and $this->ldel_length is 1. The template is utf-8 without BOM.
The warning goes away and the template is rendered correctly if I substitute the '$this->ldel_length' part with '$this->ldel_length - 1' as second argument to both the mb_substr() and substr() function calls. Could it be an 'off by one' error?
djn |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Mar 17, 2014 7:06 pm Post subject: |
|
|
This has been fixed now in the SVN trunk and will later be included in 3.1.18 |
|
Back to top |
|
djn Smarty Rookie
Joined: 15 Nov 2004 Posts: 13 Location: Trst
|
Posted: Tue Mar 18, 2014 12:26 am Post subject: |
|
|
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Mar 20, 2014 10:15 pm Post subject: |
|
|
Previous fix was buggy.
The final fix is now in the trunk. |
|
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
|