diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/CountViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/CountViewHelper.php index fc5b11760aacb6104693d83cc33d1e063c93d51b..99aa499118b79e26d7d5c558abffaf811e52c580 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/CountViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/CountViewHelper.php @@ -78,6 +78,9 @@ class CountViewHelper extends AbstractViewHelper implements CompilableInterface if (is_object($subject) && !$subject instanceof \Countable) { throw new Exception('CountViewHelper only supports arrays and objects implementing \Countable interface. Given: "' . get_class($subject) . '"', 1279808078); } - return count($subject); + if (is_array($subject) || $subject instanceof \Countable) { + return count($subject); + } + return 0; } }