diff --git a/Smarty.addons.php b/Smarty.addons.php index d9f4f675..5d9b23bb 100644 --- a/Smarty.addons.php +++ b/Smarty.addons.php @@ -86,6 +86,9 @@ function smarty_mod_escape($string, $esc_type = 'html') \*======================================================================*/ function smarty_mod_truncate($string, $length = 80, $etc = '...', $break_words = false) { + if ($length == 0) + return ''; + if (strlen($string) > $length) { $length -= strlen($etc); $fragment = substr($string, 0, $length+1);