mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- bugfix {foreach} item variable must be created also on empty from array https://github.com/smarty-php/smarty/issues/238 and https://github.com/smarty-php/smarty/issues/239
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||
12.07.2016
|
||||
- bugfix {foreach} item variable must be created also on empty from array https://github.com/smarty-php/smarty/issues/238 and https://github.com/smarty-php/smarty/issues/239
|
||||
|
||||
27.05.2016
|
||||
- bugfix/improvement of compileAlltemplates() follow symlinks in template folder (PHP >= 5.3.1) https://github.com/smarty-php/smarty/issues/224
|
||||
clear internal cache and expension handler for each template to avoid possible conflicts https://github.com/smarty-php/smarty/issues/231
|
||||
|
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.30-dev/72';
|
||||
const SMARTY_VERSION = '3.1.30-dev/73';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
|
@@ -42,27 +42,23 @@ class Smarty_Internal_Runtime_Foreach
|
||||
settype($from, 'array');
|
||||
}
|
||||
$total = ($needTotal || isset($properties[ 'total' ])) ? $this->count($from) : 1;
|
||||
if (empty($from)) {
|
||||
$from = null;
|
||||
$total = 0;
|
||||
if ($needTotal) {
|
||||
if (isset($tpl->tpl_vars[ $item ])) {
|
||||
$saveVars[ $item ] = $tpl->tpl_vars[ $item ];
|
||||
}
|
||||
$tpl->tpl_vars[ $item ] = new Smarty_Variable(null, $tpl->isRenderingCache);
|
||||
if (empty($from)) {
|
||||
$from = null;
|
||||
$total = 0;
|
||||
if ($needTotal) {
|
||||
$tpl->tpl_vars[ $item ]->total = 0;
|
||||
}
|
||||
} else {
|
||||
if (isset($tpl->tpl_vars[ $item ])) {
|
||||
$saveVars[ $item ] = $tpl->tpl_vars[ $item ];
|
||||
}
|
||||
if ($key) {
|
||||
if (isset($tpl->tpl_vars[ $key ])) {
|
||||
$saveVars[ $key ] = $tpl->tpl_vars[ $key ];
|
||||
}
|
||||
$tpl->tpl_vars[ $key ] = new Smarty_Variable(null, $tpl->isRenderingCache);
|
||||
}
|
||||
$tpl->tpl_vars[ $item ] = new Smarty_Variable(null, $tpl->isRenderingCache);
|
||||
if ($needTotal) {
|
||||
$tpl->tpl_vars[ $item ]->total = $total;
|
||||
}
|
||||
|
Reference in New Issue
Block a user