- bugfix {make_nocache $var} remove spaces from variable value https://github.com/smarty-php/smarty/issues/304

This commit is contained in:
uwetews
2016-10-19 20:43:17 +02:00
parent 80a024f44e
commit 34e5739fc1
3 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
===== 3.1.31-dev ===== (xx.xx.xx) ===== 3.1.31-dev ===== (xx.xx.xx)
19.10.2016 19.10.2016
- bugfix {make_nocache $var} did fail when variable value did contain '\' https://github.com/smarty-php/smarty/issues/305 - bugfix {make_nocache $var} did fail when variable value did contain '\' https://github.com/smarty-php/smarty/issues/305
- bugfix {make_nocache $var} remove spaces from variable value https://github.com/smarty-php/smarty/issues/304
12.10.2016 12.10.2016
- bugfix {include} with template names including variable or constants could fail after bugfix from - bugfix {include} with template names including variable or constants could fail after bugfix from

View File

@@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.31-dev/35'; const SMARTY_VERSION = '3.1.31-dev/36';
/** /**
* define variable scopes * define variable scopes

View File

@@ -23,14 +23,14 @@ class Smarty_Internal_Runtime_Make_Nocache
public function save(Smarty_Internal_Template $tpl, $var) public function save(Smarty_Internal_Template $tpl, $var)
{ {
if (isset($tpl->tpl_vars[ $var ])) { if (isset($tpl->tpl_vars[ $var ])) {
$export = preg_replace('/^Smarty_Variable::__set_state[(]|\s|[)]$/', '', $export =
var_export($tpl->tpl_vars[ $var ], true)); preg_replace('/^Smarty_Variable::__set_state[(]|[)]$/', '', var_export($tpl->tpl_vars[ $var ], true));
if (preg_match('/(\w+)::__set_state/', $export, $match)) { if (preg_match('/(\w+)::__set_state/', $export, $match)) {
throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'"); throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
} }
echo "/*%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/<?php " . echo "/*%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/<?php " .
addcslashes("\$_smarty_tpl->smarty->ext->_make_nocache->store(\$_smarty_tpl, '{$var}', ", addcslashes("\$_smarty_tpl->smarty->ext->_make_nocache->store(\$_smarty_tpl, '{$var}', ", '\\') .
'\\') . $export . ");?>\n/*/%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/"; $export . ");?>\n/*/%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/";
} }
} }