From 2c60503dfca975e6232e5d6920724553b593070d Mon Sep 17 00:00:00 2001 From: uwetews Date: Fri, 31 Aug 2018 17:32:44 +0200 Subject: [PATCH] - bugfix some custom left and right delimiters like '{^' '^}' did not work https://github.com/smarty-php/smarty/issues/450 https://github.com/smarty-php/smarty/pull/482 --- change_log.txt | 3 +++ libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_internal_templatecompilerbase.php | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 7bdf5f05..49850832 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,5 +1,8 @@ ===== 3.1.33-dev-10 ===== 31.08.2018 + - bugfix some custom left and right delimiters like '{^' '^}' did not work + https://github.com/smarty-php/smarty/issues/450 https://github.com/smarty-php/smarty/pull/482 + - reformating for PSR-2 coding standards https://github.com/smarty-php/smarty/pull/483 - bugfix on Windows absolute filepathes did fail if the drive letter was followed by a linux DIRECTORY_SEPARATOR diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 2b38e4ce..9a05d0bc 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.33-dev-10'; + const SMARTY_VERSION = '3.1.33-dev-11'; /** * define variable scopes */ diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 4e509196..a72f3a4a 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -1212,20 +1212,20 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->ldelLength = strlen($ldel); $this->ldelPreg = ''; foreach (str_split($ldel, 1) as $chr) { - $this->ldelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + $this->ldelPreg .= '[' . preg_quote($chr,'/') . ']'; } $rdel = $this->smarty->getRightDelimiter(); $this->rdelLength = strlen($rdel); $this->rdelPreg = ''; foreach (str_split($rdel, 1) as $chr) { - $this->rdelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + $this->rdelPreg .= '[' . preg_quote($chr,'/') . ']'; } $literals = $this->smarty->getLiterals(); if (!empty($literals)) { foreach ($literals as $key => $literal) { $literalPreg = ''; foreach (str_split($literal, 1) as $chr) { - $literalPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + $literalPreg .= '[' . preg_quote($chr,'/') . ']'; } $literals[ $key ] = $literalPreg; }