Bug fixes for installation
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* Smarty Internal Plugin Templatelexer
|
||||
*
|
||||
* This is the lexer to break the template source into tokens
|
||||
* This is the lexer to break the template source into tokens
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
/**
|
||||
* Smarty Internal Plugin Templatelexer
|
||||
@@ -75,8 +75,8 @@ class Smarty_Internal_Templatelexer
|
||||
'AS' => 'as',
|
||||
'TO' => 'to',
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
function __construct($data,$compiler)
|
||||
{
|
||||
// $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
|
||||
@@ -85,10 +85,10 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line = 1;
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->compiler = $compiler;
|
||||
$this->ldel = preg_quote($this->smarty->left_delimiter,'/');
|
||||
$this->ldel_length = strlen($this->smarty->left_delimiter);
|
||||
$this->ldel = preg_quote($this->smarty->left_delimiter,'/');
|
||||
$this->ldel_length = strlen($this->smarty->left_delimiter);
|
||||
$this->rdel = preg_quote($this->smarty->right_delimiter,'/');
|
||||
$this->rdel_length = strlen($this->smarty->right_delimiter);
|
||||
$this->rdel_length = strlen($this->smarty->right_delimiter);
|
||||
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
|
||||
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
|
||||
$this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
|
||||
@@ -312,8 +312,7 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
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,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
|
||||
if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : ($this->getStrpos($this->value, $this->ldel_length, 1) /*espocrm: fix a warning for PHP 7*/ !== false))) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
@@ -693,7 +692,7 @@ class Smarty_Internal_Templatelexer
|
||||
function yy_r2_46($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PTR;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PTR;
|
||||
}
|
||||
function yy_r2_47($yy_subpatterns)
|
||||
{
|
||||
@@ -855,7 +854,7 @@ class Smarty_Internal_Templatelexer
|
||||
function yy_r2_75($yy_subpatterns)
|
||||
{
|
||||
|
||||
if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
|
||||
if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : ($this->getStrpos($this->value, $this->ldel_length, 1) !== false))) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
@@ -993,7 +992,7 @@ class Smarty_Internal_Templatelexer
|
||||
$to = $match[0][1];
|
||||
} else {
|
||||
$this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
|
||||
}
|
||||
}
|
||||
if ($this->mbstring_overload) {
|
||||
$this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
|
||||
} else {
|
||||
@@ -1118,7 +1117,7 @@ class Smarty_Internal_Templatelexer
|
||||
function yy_r4_6($yy_subpatterns)
|
||||
{
|
||||
|
||||
if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
|
||||
if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : ($this->getStrpos($this->value, $this->ldel_length, 1) /*espocrm: fix a warning for PHP 7*/ !== false))) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
@@ -1393,4 +1392,12 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
|
||||
}
|
||||
|
||||
|
||||
//espocrm: fix a warning for PHP 7
|
||||
protected function getStrpos($value, $ldelLength, $offset = 0)
|
||||
{
|
||||
$substrRes = substr($value, $ldelLength, $offset);
|
||||
return !empty($substrRes) ? strpos(" \n\t\r", $substrRes) : false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user