- bugfix named {foreach} comparison like $smarty.foreach.foobar.index > 1 did compile into wrong code https://github.com/smarty-php/smarty/issues/41

This commit is contained in:
Uwe Tews
2015-05-21 00:59:26 +02:00
parent 5d8718f761
commit c8ecad0b06
3 changed files with 3 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
 ===== 3.1.24.dev ===== (xx.xx.2015)  ===== 3.1.24.dev ===== (xx.xx.2015)
21.05.2015 21.05.2015
- bugfix broken PHP 5.2 compatibility when compiling <?php tags https://github.com/smarty-php/smarty/issues/40 - bugfix broken PHP 5.2 compatibility when compiling <?php tags https://github.com/smarty-php/smarty/issues/40
- bugfix named {foreach} comparison like $smarty.foreach.foobar.index > 1 did compile into wrong code https://github.com/smarty-php/smarty/issues/41
19.05.2015 19.05.2015
- bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39 - bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.24-dev/8'; const SMARTY_VERSION = '3.1.24-dev/9';
/** /**
* define variable scopes * define variable scopes

View File

@@ -35,7 +35,7 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
case 'foreach': case 'foreach':
$name = trim($_index[1], "'"); $name = trim($_index[1], "'");
$foreachVar = "'__foreach_{$name}'"; $foreachVar = "'__foreach_{$name}'";
return "isset(\$_smarty_tpl->tpl_vars[$foreachVar]->value[{$_index[2]}]) ? \$_smarty_tpl->tpl_vars[$foreachVar]->value[{$_index[2]}] : null"; return "(isset(\$_smarty_tpl->tpl_vars[$foreachVar]->value[{$_index[2]}]) ? \$_smarty_tpl->tpl_vars[$foreachVar]->value[{$_index[2]}] : null)";
case 'section': case 'section':
return "\$_smarty_tpl->getVariable('smarty')->value$parameter"; return "\$_smarty_tpl->getVariable('smarty')->value$parameter";
case 'capture': case 'capture':