From 0429272370f97e722ad29f4b4da69382dc7489e8 Mon Sep 17 00:00:00 2001 From: uwetews Date: Wed, 7 Sep 2016 00:41:31 +0200 Subject: [PATCH] - bugfix when {foreach} was looping over an object the total property like {$item@total} did always return 1 https://github.com/smarty-php/smarty/issues/281 --- change_log.txt | 3 ++- libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_internal_runtime_foreach.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/change_log.txt b/change_log.txt index d175aa27..c61cd264 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,7 +2,8 @@ 07.09.2016 - bugfix using nocache like attribute with value true like {plugin nocache=true} did not work https://github.com/smarty-php/smarty/issues/285 - bugfix uppercase TRUE, FALSE and NULL did not work when security was enabled https://github.com/smarty-php/smarty/issues/282 - + - bugfix when {foreach} was looping over an object the total property like {$item@total} did always return 1 https://github.com/smarty-php/smarty/issues/281 + 01.09.2016 - performance require_once should be called only once for shared plugins https://github.com/smarty-php/smarty/issues/280 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 436589ad..94c4f0e4 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.31-dev/10'; + const SMARTY_VERSION = '3.1.31-dev/11'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_runtime_foreach.php b/libs/sysplugins/smarty_internal_runtime_foreach.php index bdefe692..c93c6276 100644 --- a/libs/sysplugins/smarty_internal_runtime_foreach.php +++ b/libs/sysplugins/smarty_internal_runtime_foreach.php @@ -130,7 +130,7 @@ class Smarty_Internal_Runtime_Foreach return 1; } } elseif (is_object($value)) { - return count($value); + return count((array)$value); } return 0; }