ranlt / smarty-php

Automatically exported from code.google.com/p/smarty-php
0 stars 0 forks source link

mb_strpos(): Empty delimiter in file smarty_internal_templatelexer.php at line: 316 #181

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
mb_strpos(): Empty delimiter in file smarty_internal_templatelexer.php at line: 
316

It's been there since smarty 3.1.15. I also tested it on the trunk version. A 
fix would be to check if the substr is empty or not in 
smarty_internal_templatelexer.php.

I assume this has to do with the mb overloading. Not exactly sure how to 
reproduce it as it happened after the 3.1.14 version.

Below the fix I implemented locally on the trunk version to see if it was the 
only problem. 

function yy_r1_13($yy_subpatterns)
    {
        $substr = $this->mbstring_overload 
                ? mb_substr($this->value,$this->ldel_length,1,'latin1') 
                : substr($this->value,$this->ldel_length,1,'latin1');

  if ($this->smarty->auto_literal && !empty($substr) && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",$substr,0,'latin1') !== false) : (strpos(" \n\t\r",$substr) !== false))) {
    $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  } else {
     $this->token = Smarty_Internal_Templateparser::TP_LDEL;
     $this->yypushstate(self::SMARTY);
     $this->taglineno = $this->line;
  }

Original issue reported on code.google.com by powerass...@gmail.com on 19 Mar 2014 at 10:28

GoogleCodeExporter commented 9 years ago
This has been fixed in the SVN trunk on March 20th

Original comment by Uwe.Tews@googlemail.com on 21 Mar 2014 at 11:02